{"record":{"id":"9eb6509da4da7b95","repo":"MemPalace/mempalace","slug":"update-requires-at-least-one-of-documents-metadat","errorCode":null,"errorMessage":"update requires at least one of documents, metadatas, embeddings","messagePattern":"update requires at least one of documents, metadatas, embeddings","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"mempalace/backends/base.py","lineNumber":560,"sourceCode":"        where: Optional[dict] = None,\n    ) -> LexicalResult:\n        raise UnsupportedCapabilityError(\"backend does not support lexical_search\")\n\n    def update(\n        self,\n        *,\n        ids: list[str],\n        documents: Optional[list[str]] = None,\n        metadatas: Optional[list[dict]] = None,\n        embeddings: Optional[list[list[float]]] = None,\n    ) -> None:\n        \"\"\"Default non-atomic update: get + merge + upsert.\n\n        Backends advertising ``supports_update`` MUST override with an atomic\n        single-round-trip implementation.\n        \"\"\"\n        if documents is None and metadatas is None and embeddings is None:\n            raise ValueError(\"update requires at least one of documents, metadatas, embeddings\")\n\n        n = len(ids)\n        for label, value in (\n            (\"documents\", documents),\n            (\"metadatas\", metadatas),\n            (\"embeddings\", embeddings),\n        ):\n            if value is not None and len(value) != n:\n                raise ValueError(f\"{label} length {len(value)} does not match ids length {n}\")\n\n        existing = self.get(ids=ids, include=[\"documents\", \"metadatas\"])\n        by_id = {\n            rid: (existing.documents[i], existing.metadatas[i])\n            for i, rid in enumerate(existing.ids)\n        }\n        merged_docs: list[str] = []\n        merged_metas: list[dict] = []\n        for i, rid in enumerate(ids):","sourceCodeStart":542,"sourceCodeEnd":578,"githubUrl":"https://github.com/MemPalace/mempalace/blob/06cb6987f02610784fefbad4b2bd5d026d164ba6/mempalace/backends/base.py#L542-L578","documentation":"Raised as RebuildCleanupError when the final cleanup stage (FTS5 index rebuild + VACUUM + quick_check, strict=True) fails after all data rows were already successfully rebuilt into the destination palace. The data is intact but the derived index may be malformed, so the operation cannot report success. The message tells you where the recovered palace and the original (archived or unchanged) live.","triggerScenarios":"_vacuum_and_rebuild_fts5(dest_palace, strict=True) raises — locked SQLite file, disk exhaustion during VACUUM (which needs free space roughly equal to the DB size), or a quick_check failure after upserts.","commonSituations":"VACUUM failing on a full disk; another process (MCP server, miner) holding chroma.sqlite3 during recovery; FTS5 index corruption left behind by interrupted bulk upserts.","solutions":["Free disk space (VACUUM needs headroom comparable to the DB size) and close any process holding the recovered chroma.sqlite3.","Keep the recovered palace at dest_palace — the row data is fully rebuilt; only the derived index is suspect.","Re-run the FTS5 rebuild / VACUUM manually against dest_palace, or re-run the recovery which will redo cleanup.","If cleanup still fails, fall back to the archived original (archive_path) or the unchanged source palace."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"import shutil\nif shutil.disk_usage(dest_palace).free < db_size:\n    raise SystemExit('VACUUM needs free space ~ DB size')","typeGuard":null,"tryCatchPattern":"try:\n    run_recovery(...)\nexcept RebuildCleanupError as e:\n    # row data is intact at e.dest_palace; only derived index is suspect\n    close_holders_and_rerun_cleanup(e.dest_palace)","preventionTips":["Free disk headroom (~2x DB size) before recovery runs.","Close all processes holding chroma.sqlite3 during recovery.","Do not delete the recovered palace after this error — data is already rebuilt."],"tags":["sqlite","vacuum","fts5","recovery","cleanup"],"backgroundTag":null,"analyzedSha":"06cb6987f02610784fefbad4b2bd5d026d164ba6","analyzedAt":"2026-08-15T03:03:36.213Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}