{"record":{"id":"8c36a2f90deaffbc","repo":"MemPalace/mempalace","slug":"abort-chroma-sqlite3-reports-sqlite-count","errorCode":null,"errorMessage":"\n  ABORT: chroma.sqlite3 reports {sqlite_count:,} drawers but only {extracted:,}\n  came back through the chromadb collection layer. The segment metadata is\n  stale (often after manual HNSW quarantine) — proceeding would silently\n  destroy {loss:,} drawers (~{pct:.0f}%).\n\n  Recovery options:\n    1. Restore from your most recent palace backup, then re-mine.\n    2. Direct-extract from chroma.sqlite3 (rows are still on disk) and\n       rebuild the palace from source files.\n    3. If you have independently confirmed the palace really contains only\n       {extracted:,} drawers, re-run with --confirm-truncation-ok.\n","messagePattern":"\n  ABORT: chroma\\.sqlite3 reports \\{sqlite_count:,\\} drawers but only \\{extracted:,\\}\n  came back through the chromadb collection layer\\. The segment metadata is\n  stale \\(often after manual HNSW quarantine\\) — proceeding would silently\n  destroy \\{loss:,\\} drawers \\(~\\{pct:\\.0f\\}%\\)\\.\n\n  Recovery options:\n    1\\. Restore from your most recent palace backup, then re-mine\\.\n    2\\. Direct-extract from chroma\\.sqlite3 \\(rows are still on disk\\) and\n       rebuild the palace from source files\\.\n    3\\. If you have independently confirmed the palace really contains only\n       \\{extracted:,\\} drawers, re-run with --confirm-truncation-ok\\.\n","errorType":"exception","errorClass":"TruncationDetected","httpStatus":null,"severity":"error","filePath":"mempalace/repair.py","lineNumber":674,"sourceCode":"    cap_signal = extracted == CHROMADB_DEFAULT_GET_LIMIT\n\n    if sqlite_count is not None and sqlite_count > extracted:\n        loss = sqlite_count - extracted\n        pct = 100 * loss / sqlite_count\n        message = (\n            f\"\\n  ABORT: chroma.sqlite3 reports {sqlite_count:,} drawers but only {extracted:,}\\n\"\n            \"  came back through the chromadb collection layer. The segment metadata is\\n\"\n            \"  stale (often after manual HNSW quarantine) — proceeding would silently\\n\"\n            f\"  destroy {loss:,} drawers (~{pct:.0f}%).\\n\"\n            \"\\n\"\n            \"  Recovery options:\\n\"\n            \"    1. Restore from your most recent palace backup, then re-mine.\\n\"\n            \"    2. Direct-extract from chroma.sqlite3 (rows are still on disk) and\\n\"\n            \"       rebuild the palace from source files.\\n\"\n            \"    3. If you have independently confirmed the palace really contains only\\n\"\n            f\"       {extracted:,} drawers, re-run with --confirm-truncation-ok.\\n\"\n        )\n        raise TruncationDetected(message, sqlite_count, extracted)\n\n    if cap_signal and sqlite_count is None:\n        message = (\n            f\"\\n  ABORT: extracted exactly {CHROMADB_DEFAULT_GET_LIMIT:,} drawers, which matches\\n\"\n            \"  ChromaDB's internal default get() limit. The on-disk SQLite count couldn't\\n\"\n            \"  be cross-checked from this Python context, so we can't tell whether the\\n\"\n            f\"  palace genuinely holds {CHROMADB_DEFAULT_GET_LIMIT:,} rows or whether extraction was\\n\"\n            \"  silently capped. Refusing to overwrite the palace.\\n\"\n            \"\\n\"\n            \"  If you have independently confirmed (e.g. via direct sqlite3 query) that\\n\"\n            f\"  the palace really contains exactly {CHROMADB_DEFAULT_GET_LIMIT:,} drawers, re-run with\\n\"\n            \"  --confirm-truncation-ok.\\n\"\n        )\n        raise TruncationDetected(message, sqlite_count, extracted)\n\n\ndef sqlite_drawer_count(palace_path: str, collection_name: Optional[str] = None) -> \"int | None\":\n    \"\"\"Count rows in ``chroma.sqlite3.embeddings`` for the drawers collection.","sourceCodeStart":656,"sourceCodeEnd":692,"githubUrl":"https://github.com/MemPalace/mempalace/blob/06cb6987f02610784fefbad4b2bd5d026d164ba6/mempalace/repair.py#L656-L692","documentation":"Error \"\n  ABORT: chroma.sqlite3 reports {sqlite_count:,} drawers but only {extracted:,}\n  came back through the chromadb collection layer. The segment metadata is\n  stale (often after manual HNSW quarantine) — proceeding would silently\n  destroy {loss:,} drawers (~{pct:.0f}%).\n\n  Recovery options:\n    1. Restore from your most recent palace backup, then re-mine.\n    2. Direct-extract from chroma.sqlite3 (rows are still on disk) and\n       rebuild the palace from source files.\n    3. If you have independently confirmed the palace really contains only\n       {extracted:,} drawers, re-run with --confirm-truncation-ok.\n\" thrown in MemPalace/mempalace.","triggerScenarios":"Thrown at mempalace/repair.py:674 when the library encounters an invalid state.","commonSituations":"Stale segment metadata hid most drawers; extraction would have silently destroyed them.","solutions":["Restore from backup and re-mine, direct-extract from chroma.sqlite3, or re-run with --confirm-truncation-ok if the count is confirmed correct"],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"06cb6987f02610784fefbad4b2bd5d026d164ba6","analyzedAt":"2026-08-15T03:03:36.213Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}