fix(backends): repair missing _type in collection config (#1611) - #1617
Merged
igorls merged 2 commits intoMay 30, 2026
Conversation
) chromadb <= 1.5.8 writes config_json_str = '{}' (empty JSON) when creating collections. chromadb 1.5.9 introduced a strict _type check in the collection config deserialization path -- its absence raises KeyError: '_type' on palace open. Since the pin allows >=1.5.4,<2, any upgrade pulls 1.5.9 and breaks every existing palace. Add a fourth pre-open migration step (_fix_missing_collection_type) that injects "_type": "CollectionConfigurationInternal" into collections.config_json_str rows that lack it. Same lifecycle and marker-file pattern as the existing _fix_blob_seq_ids. Co-Authored-By: nautis <nautis@users.noreply.github.com> Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Code Review
This pull request introduces a migration utility, _fix_missing_collection_type, to ensure compatibility with chromadb 1.5.9+ by adding a missing _type field to collection configurations within the SQLite database. The migration is integrated into the pre-open safety pass and is accompanied by comprehensive unit tests. Feedback identifies that the SQLite connection in the migration function is not explicitly closed by the context manager, which could lead to resource leaks or file locks; a try...finally block is recommended to ensure the connection is closed before the PersistentClient is instantiated.
Address review feedback: `with sqlite3.connect() as conn:` only manages transactions, it does not close the connection. An open connection before PersistentClient instantiation can leave WAL state. Use explicit `try...finally: conn.close()` matching the read-only helpers elsewhere in the module. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This was referenced May 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
chromadb <= 1.5.8 writes
config_json_str = '{}'(empty JSON) when creatingcollections. chromadb 1.5.9 introduced a strict
_typecheck in thecollection config deserialization path -- its absence raises
KeyError: '_type'on palace open. Since the pin allows>=1.5.4,<2,any
uv tool upgrade mempalacepulls 1.5.9 and breaks every existing palace.This adds a fourth pre-open migration step (
_fix_missing_collection_type)that injects
"_type": "CollectionConfigurationInternal"intocollections.config_json_strrows that lack it. Same lifecycle and marker-filepattern as the existing
_fix_blob_seq_ids..collection_type_fixedskips sqlite on repeat opensCloses #1611
Related: #445 (same root error, SQL fix recipe by @nautis)
How to test
marker write/skip, noop-marker when valid, multi-collection mixed
(NULL + empty + valid), non-dict JSON, malformed JSON
config_json_str = {}, reopen viaChromaBackend._client(), confirm fix applied, query returns results_typeopens on chromadb 1.5.7/1.5.8,add + query work
Checklist
python -m pytest tests/ -v)ruff check .)