Skip to content

Double upgrading a repo object causes a panic #1524

@ianhi

Description

@ianhi

What happened?

If you call upgrade repo on the same repo object multiple times you cause a panic.

➜  version-compat-tests git:(ian/v1-v2-regression-tests) ✗ uv run python scripts/double_upgrade.py

thread '<unnamed>' (5051741) panicked at /Users/runner/work/icechunk/icechunk/icechunk/src/format/repo_info.rs:168:9:
assertion failed: main_found
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Traceback (most recent call last):
  File "/Users/ian/Documents/dev/icechunk/version-compat-tests/scripts/double_upgrade.py", line 28, in <module>
    main()
    ~~~~^^
  File "/Users/ian/Documents/dev/icechunk/version-compat-tests/scripts/double_upgrade.py", line 24, in main
    icechunk.upgrade_icechunk_repository(repo, dry_run=False)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ian/Documents/dev/icechunk/version-compat-tests/.venv/lib/python3.14/site-packages/icechunk/__init__.py", line 267, in upgrade_icechunk_repository
    _upgrade_icechunk_repository(
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
        repo._repository, dry_run=dry_run, delete_unused_v1_files=delete_unused_v1_files
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
pyo3_runtime.PanicException: assertion failed: main_found

What did you expect to happen?

no panics!

Minimal Complete Verifiable Example

# /// script
# requires-python = ">=3.11"
# dependencies = [
#   "icechunk<2",
#   "zarr",
# ]
#
# [[tool.uv.index]]
# name = "scientific-python-nightly-wheels"
# url = "https://pypi.anaconda.org/scientific-python-nightly-wheels/simple/"
#
# [tool.uv.sources]
# icechunk = { index = "scientific-python-nightly-wheels" }
# zarr = { index = "scientific-python-nightly-wheels" }
#
# [tool.uv]
# prerelease = "allow"
# ///
#
# This script automatically imports the development branch of icechunk to check for issues.
# Please delete this header if you have _not_ tested this script with `uv run`!
import tempfile
import icechunk
import zarr


icechunk.set_logs_filter("icechunk::storage::object_store=error")

tmpdir = tempfile.mkdtemp()
storage = icechunk.local_filesystem_storage(tmpdir)

# Create repo with spec_version=1
repo = icechunk.Repository.create(storage, spec_version=1)

# Make initial data and commit
session = repo.writable_session("main")
root = zarr.open_group(session.store, mode="w")
arr = root.create_array("data", shape=(2,), dtype="i4")
arr[:] = [1, 2]
commit1 = session.commit("first commit")

# Upgrade to spec_version=2
icechunk.upgrade_icechunk_repository(repo, dry_run=False)
icechunk.upgrade_icechunk_repository(repo, dry_run=False)

MVCE confirmation

  • Minimal example — the example is as focused as reasonably possible to demonstrate the underlying issue in icechunk.
  • Complete example — the example is self-contained, including all data and the text of any traceback.
  • Verifiable example — the example copy & pastes into an IPython prompt, returning the result.
  • New issue — a search of GitHub Issues suggests this is not a duplicate.
  • Recent environment — the issue occurs with the latest version of icechunk and its dependencies.

Relevant log output

Anything else we need to know?

No response

Environment

Details

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions