You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This whole message is AI-generated. The issue was automatically discovered and reported by an AI agent (Claude) during an autonomous bug hunt on the spatialdata code base. It has not been verified or triaged by a human yet; the needs: triage label is set so that a maintainer can confirm it. The reproduction script below was executed by the agent in an isolated environment (see Environment) and its output is pasted verbatim.
Summary
A table without spatialdata_attrs (orphan table, supported elsewhere via include_orphan_tables) makes concatenate({...}) raise ValueError: No spatialdata_attrs key found in table.uns. 2. The signature accepts Iterable[SpatialData] but a generator is exhausted after the first pass, so the length check fails with KeyError: 'Images must have unique names across the SpatialData objects to concatenate...'.
Severity (agent's assessment): low
Where:src/spatialdata/_core/concatenate.py (_fix_ensure_unique_element_names calls get_table_keys(table) unconditionally; concatenate iterates sdatas several times)
Expected behaviour
Orphan tables are carried over (renamed with the suffix); generators are materialised with list(sdatas) or the type hint is Sequence.
Reproduction
Save as repro.py and run uv run repro.py (the PEP 723 header pins spatialdata to the commit the bug was found on; replace the URL fragment with @main to test the current main branch).
# /// script# requires-python = ">=3.12"# dependencies = [# "spatialdata @ git+https://github.com/scverse/spatialdata.git@ccf1ea048d054b6624214bf618008a9f9ae223e0",# ]# ///"""concatenate(): orphan tables crash the dict form; a generator input gives a misleading error."""importwarningsimportnumpyasnpfromanndataimportAnnDatafromspatialdataimportSpatialData, concatenatefromspatialdata.modelsimportImage2DModelwarnings.simplefilter("ignore")
defmk():
returnSpatialData(images={"img": Image2DModel.parse(np.zeros((1, 4, 4), dtype=np.uint8))})
bug=Falses1, s2=mk(), mk()
s1.tables["orphan"] =AnnData(X=np.zeros((2, 1))) # table without spatialdata_attrs (allowed elsewhere)try:
m=concatenate({"a": s1, "b": s2})
print("dict form with an orphan table: OK ->", list(m.tables))
exceptExceptionase: # noqa: BLE001print("dict form with an orphan table:", type(e).__name__, str(e)[:100])
bug=Truetry:
concatenate(sforsin [mk(), mk()])
print("generator input: OK")
exceptExceptionase: # noqa: BLE001print("generator input:", type(e).__name__, str(e)[:100])
bug=Trueprint("VERDICT:", "BUG REPRODUCED"ifbugelse"NOT REPRODUCED")
Observed output
dict form with an orphan table: ValueError No spatialdata_attrs key found in table.uns, therefore, no table keys found. Please parse the table.
generator input: KeyError 'Images must have unique names across the SpatialData objects to concatenate. Please pass a `dict[st
VERDICT: BUG REPRODUCED
Possible fix direction (unverified)
See above.
Environment
uv run repro.py with the PEP 723 metadata in the script (fresh, isolated environment; spatialdata built from main @ ccf1ea0 (2026-08-28); Python 3.13, latest releases of the dependencies at run time: pandas 3.0, anndata 0.13, zarr 3.3, dask 2026.8, numpy 2.5, geopandas 1.1, shapely 2.1). macOS (arm64). Also reproduced in a second environment with pandas 2.3.3 / anndata 0.12.11 / numpy 2.4.4 / zarr 3.2.1.
Automatically generated; discovered by an AI agent (Claude) and not yet reviewed by a human.
Note
This whole message is AI-generated. The issue was automatically discovered and reported by an AI agent (Claude) during an autonomous bug hunt on the
spatialdatacode base. It has not been verified or triaged by a human yet; theneeds: triagelabel is set so that a maintainer can confirm it. The reproduction script below was executed by the agent in an isolated environment (see Environment) and its output is pasted verbatim.Summary
spatialdata_attrs(orphan table, supported elsewhere viainclude_orphan_tables) makesconcatenate({...})raiseValueError: No spatialdata_attrs key found in table.uns. 2. The signature acceptsIterable[SpatialData]but a generator is exhausted after the first pass, so the length check fails withKeyError: 'Images must have unique names across the SpatialData objects to concatenate...'.Severity (agent's assessment): low
Where:
src/spatialdata/_core/concatenate.py(_fix_ensure_unique_element_namescallsget_table_keys(table)unconditionally;concatenateiteratessdatasseveral times)Expected behaviour
Orphan tables are carried over (renamed with the suffix); generators are materialised with
list(sdatas)or the type hint isSequence.Reproduction
Save as
repro.pyand runuv run repro.py(the PEP 723 header pinsspatialdatato the commit the bug was found on; replace the URL fragment with@mainto test the current main branch).Observed output
Possible fix direction (unverified)
See above.
Environment
uv run repro.pywith the PEP 723 metadata in the script (fresh, isolated environment;spatialdatabuilt frommain@ ccf1ea0 (2026-08-28); Python 3.13, latest releases of the dependencies at run time: pandas 3.0, anndata 0.13, zarr 3.3, dask 2026.8, numpy 2.5, geopandas 1.1, shapely 2.1). macOS (arm64). Also reproduced in a second environment with pandas 2.3.3 / anndata 0.12.11 / numpy 2.4.4 / zarr 3.2.1.Automatically generated; discovered by an AI agent (Claude) and not yet reviewed by a human.