{"record":{"id":"18397d12bcad80df","repo":"MemPalace/mempalace","slug":"drawer-write-was-acknowledged-but-the-new-id-is-no","errorCode":null,"errorMessage":"Drawer write was acknowledged but the new ID is not readable. The palace index may be stale; run reconnect or repair.","messagePattern":"Drawer write was acknowledged but the new ID is not readable\\. The palace index may be stale; run reconnect or repair\\.","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"mempalace/mcp_server.py","lineNumber":3002,"sourceCode":"        idempotency_probe_ids = [drawer_id, f\"{drawer_id}_chunk_{last_chunk_idx:06d}\"]\n    try:\n        existing = col.get(ids=idempotency_probe_ids, include=[])\n        if _get_result_ids(existing):\n            return {\"success\": True, \"reason\": \"already_exists\", \"drawer_id\": drawer_id}\n    except Exception as e:\n        logger.warning(\"Idempotency pre-check failed for %s\", idempotency_probe_ids, exc_info=True)\n        return {\"success\": False, \"error\": f\"Idempotency check failed before write: {e}\"}\n\n    try:\n        if len(content) <= chunk_size:\n            col.upsert(\n                ids=[drawer_id],\n                documents=[content],\n                metadatas=[{**base_meta, \"chunk_index\": 0}],\n            )\n            inserted = col.get(ids=[drawer_id], include=[])\n            if not _get_result_ids(inserted):\n                raise RuntimeError(\n                    \"Drawer write was acknowledged but the new ID is not readable. \"\n                    \"The palace index may be stale; run reconnect or repair.\"\n                )\n            _metadata_cache = None\n            logger.info(f\"Filed drawer: {drawer_id} -> {wing}/{room}\")\n            return {\n                \"success\": True,\n                \"drawer_id\": drawer_id,\n                \"wing\": wing,\n                \"room\": room,\n                \"chunks\": 1,\n            }\n\n        # Oversized content: split into bounded per-chunk drawers so the\n        # embedding model never sees a document above ``chunk_size``.\n        # Single batched ``upsert`` so the embedding pass either commits\n        # every chunk or none — no half-written palace if the embedding\n        # model fails mid-loop (#1539).","sourceCodeStart":2984,"sourceCodeEnd":3020,"githubUrl":"https://github.com/MemPalace/mempalace/blob/06cb6987f02610784fefbad4b2bd5d026d164ba6/mempalace/mcp_server.py#L2984-L3020","documentation":"Error \"Drawer write was acknowledged but the new ID is not readable. The palace index may be stale; run reconnect or repair.\" thrown in MemPalace/mempalace.","triggerScenarios":"Thrown at mempalace/mcp_server.py:3002 when the library encounters an invalid state.","commonSituations":"Write succeeded but immediate read-back failed due to a stale palace index.","solutions":["Run the reconnect or repair tool to rebuild the stale index"],"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"}