{"record":{"id":"515335f532831b3b","repo":"MemPalace/mempalace","slug":"collection-was-built-with-a-stored-dimension-dim","errorCode":null,"errorMessage":"collection was built with a {stored.dimension}-dim embedder ({stored.model_name!r}) but the current embedder is {current.dimension}-dim ({current.model_name!r}); the stored vectors are incompatible. Re-embed the palace to switch models.","messagePattern":"collection was built with a (.+?)-dim embedder \\((.+?)\\) but the current embedder is (.+?)-dim \\((.+?)\\); the stored vectors are incompatible\\. Re-embed the palace to switch models\\.","errorType":"exception","errorClass":"DimensionMismatchError","httpStatus":null,"severity":"critical","filePath":"mempalace/backends/base.py","lineNumber":233,"sourceCode":"    \"\"\"\n    if current is None or not current.model_name:\n        return \"unknown\"\n    if stored is None:\n        return \"unknown\"\n\n    dim_conflict = bool(stored.dimension and current.dimension) and (\n        stored.dimension != current.dimension\n    )\n    name_conflict = stored.model_name != current.model_name\n\n    if not dim_conflict and not name_conflict:\n        return \"known_match\"\n\n    if force_model_swap:\n        return \"known_mismatch\"\n\n    if dim_conflict:\n        raise DimensionMismatchError(\n            f\"collection was built with a {stored.dimension}-dim embedder \"\n            f\"({stored.model_name!r}) but the current embedder is \"\n            f\"{current.dimension}-dim ({current.model_name!r}); the stored \"\n            \"vectors are incompatible. Re-embed the palace to switch models.\"\n        )\n    raise EmbedderIdentityMismatchError(\n        f\"collection was built with embedder {stored.model_name!r} but the \"\n        f\"current embedder is {current.model_name!r}. Searching across a model \"\n        \"swap silently degrades recall. Re-embed the palace, or run \"\n        \"`mempalace palace set-embedder --model <name> --force` to record the \"\n        \"new identity if you know the vectors are compatible.\"\n    )\n\n\n@dataclass(frozen=True)\nclass HealthStatus:\n    ok: bool\n    detail: str = \"\"","sourceCodeStart":215,"sourceCodeEnd":251,"githubUrl":"https://github.com/MemPalace/mempalace/blob/06cb6987f02610784fefbad4b2bd5d026d164ba6/mempalace/backends/base.py#L215-L251","documentation":"Raised as RebuildCollectionError (live_replaced=True) when a collection rebuild already deleted the old live collection and swapped in a new one, but re-uploading the extracted rows into the new collection then failed. The pre-swap copy still exists under the temp collection name and is the only verified copy of the data. The code deliberately does NOT delete the temp collection on this path because doing so would destroy the last recoverable copy.","triggerScenarios":"Calling the rebuild-collection path in mempalace/repair.py when the upsert/re-upload stage raises after the swap stage completed (live_replaced is True). Any exception during the re-upload into the freshly-promoted '{collection_name}' collection hits this handler.","commonSituations":"Disk filling up mid-upload, chromadb raising on a bad embedding dimension or corrupted segment, or the process being interrupted after the swap point. Operators who assume the error means 'total loss' and delete everything, including '{temp_name}', make it unrecoverable.","solutions":["Do NOT delete the temp collection named in the message — it is the only intact verified copy.","Remove the broken '{collection_name}' collection via the backend (e.g. chroma client.delete_collection).","Re-run the rebuild/promotion so '{temp_name}' is promoted into '{collection_name}', or manually rename it in the backend.","Investigate the original {exc} (disk space, chromadb logs) before retrying the upload so the retry does not fail the same way."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try:\n    rebuild_collection(...)\nexcept RebuildCollectionError as e:\n    if e.live_replaced:\n        # temp collection is the ONLY copy — promote it, never delete\n        promote_temp_collection(backend, palace_path, temp_name)\n    else:\n        # safe to clean up and retry\n        retry_rebuild()","preventionTips":["Verify free disk space and chromadb health before starting a rebuild.","Take a palace backup before any rebuild command.","Treat live_replaced=True errors as recovery operations, not failures to retry blindly."],"tags":["data-loss","chromadb","rebuild","recovery"],"backgroundTag":null,"analyzedSha":"06cb6987f02610784fefbad4b2bd5d026d164ba6","analyzedAt":"2026-08-15T03:03:36.213Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}