fix: batch ChromaDB reads to avoid SQLite variable limit#66
Merged
bensig merged 1 commit intoMemPalace:mainfrom Apr 7, 2026
Merged
fix: batch ChromaDB reads to avoid SQLite variable limit#66bensig merged 1 commit intoMemPalace:mainfrom
bensig merged 1 commit intoMemPalace:mainfrom
Conversation
col.get() without limit generates SELECT ... WHERE id IN (...) with all document IDs, which exceeds SQLite's ~999 variable limit when a palace has more than ~1000 drawers. This breaks both `mempalace compress` and `mempalace wake-up` on large palaces. Reproduced on a 13880-file codebase (242K+ drawers). Fix: paginate reads in batches of 500 using ChromaDB's offset/limit parameters in both Layer1.generate() and cmd_compress().
GoodOlClint
added a commit
to GoodOlClint/mempalace
that referenced
this pull request
Apr 7, 2026
Paginates col.get() in 500-item batches in compress and layers. Prevents crash when palace exceeds SQLite's ~999 host parameter limit. Upstream: MemPalace#66 Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
6 tasks
6 tasks
6 tasks
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.
Summary
col.get()withoutlimitgeneratesSELECT ... WHERE id IN (...)with all document IDsmempalace compressandmempalace wake-upon large palacesReproduction
Error:
Error reading drawers: Error executing plan: Internal error: error returned from database: (code: 1) too many SQL variablesFix
Paginate reads in batches of 500 using ChromaDB's
offset/limitparameters in:Layer1.generate()(layers.py)cmd_compress()(cli.py)Test plan
mempalace compress --wing 00_ai_fleet --dry-runcompletes successfullymempalace wake-up --wing 00_ai_fleetreturns ~851 tokens of contextmempalace searchcontinues to work (unaffected by this change)