[RozumLife Agent Team on behalf of Vitali B:]
Summary
mempalace status raises a ChromaDB InternalError (SQLite too many SQL variables) when the palace contains a large number of drawers. In our case: 123,050 drawers, 794 MB database.
Steps to reproduce
- Mine a large project directory without
--limit until the palace exceeds ~32k drawers
- Run
mempalace status
Error
chromadb.errors.InternalError: Error executing plan: Internal error: error returned from database: (code: 1) too many SQL variables
File "mempalace/miner.py", line 826, in status
r = col.get(limit=total, include=["metadatas"]) if total else {"metadatas": []}
Root cause
cmd_status queries each collection with col.get(limit=total, include=["metadatas"]). When total is large (≥ ~32,767 depending on the SQLite build), ChromaDB's internal query generates more SQL bind variables than SQLite allows, causing the crash.
Environment
- mempalace: 3.3.0
- chromadb: 1.5.7
- OS: Windows 11 (SQLite variable limit is platform-independent)
- Palace size: 123,050 drawers, 794 MB (
chroma.sqlite3)
Impact
status — crashes (unusable at scale)
compress — crashed in v3.0.0 with the same error; fixed in v3.3.0 ✓
search, mine, compress (v3.3.0) — all work correctly at this scale ✓
Suggested fix
Paginate the col.get() call in cmd_status rather than fetching all entries in a single query:
PAGE = 5000
offset = 0
metadatas = []
while True:
batch = col.get(limit=PAGE, offset=offset, include=["metadatas"])
if not batch["metadatas"]:
break
metadatas.extend(batch["metadatas"])
offset += PAGE
This is the same pattern that fixed the v3.0.0 compress crash. The compress fix in v3.3.0 already uses chunked fetching — status just needs the same treatment.
Notes
compress in v3.3.0 successfully processed all 62,963 drawers with no SQL error, confirming chunked fetching works.
- Workaround: use
mempalace search "" with --wing / --room filters to get approximate per-room counts.
[RozumLife Agent Team on behalf of Vitali B:]
Summary
mempalace statusraises a ChromaDBInternalError(SQLitetoo many SQL variables) when the palace contains a large number of drawers. In our case: 123,050 drawers, 794 MB database.Steps to reproduce
--limituntil the palace exceeds ~32k drawersmempalace statusError
Root cause
cmd_statusqueries each collection withcol.get(limit=total, include=["metadatas"]). Whentotalis large (≥ ~32,767 depending on the SQLite build), ChromaDB's internal query generates more SQL bind variables than SQLite allows, causing the crash.Environment
chroma.sqlite3)Impact
status— crashes (unusable at scale)compress— crashed in v3.0.0 with the same error; fixed in v3.3.0 ✓search,mine,compress(v3.3.0) — all work correctly at this scale ✓Suggested fix
Paginate the
col.get()call incmd_statusrather than fetching all entries in a single query:This is the same pattern that fixed the v3.0.0
compresscrash. Thecompressfix in v3.3.0 already uses chunked fetching —statusjust needs the same treatment.Notes
compressin v3.3.0 successfully processed all 62,963 drawers with no SQL error, confirming chunked fetching works.mempalace search ""with--wing/--roomfilters to get approximate per-room counts.