{"record":{"id":"45020fa1ade2bb79","repo":"MemPalace/mempalace","slug":"upsert-failed-in-collection-collection-name-r-af","errorCode":null,"errorMessage":"Upsert failed in collection {collection_name!r} after {upserted} rows: {exc!r}","messagePattern":"Upsert failed in collection (.+?) after (.+?) rows: (.+?)","errorType":"exception","errorClass":"RebuildPartialError","httpStatus":null,"severity":"error","filePath":"mempalace/repair.py","lineNumber":1458,"sourceCode":"        _flush()\n    except Exception as exc:  # noqa: BLE001 — chromadb raises many shapes\n        partial = dict(counts_so_far)\n        partial[collection_name] = upserted\n        msg_parts = [\n            f\"Upsert failed in collection {collection_name!r} after {upserted} rows: {exc!r}\",\n            f\"Partial palace left at: {dest_palace}\",\n        ]\n        if archive_path is not None:\n            msg_parts.append(f\"Original palace archived at: {archive_path}\")\n            msg_parts.append(\n                \"  Recover by removing the partial dest and re-running with \"\n                f\"--source {archive_path}\"\n            )\n        else:\n            msg_parts.append(\"  Source palace is unchanged. Remove the partial dest and re-run.\")\n        message = \"\\n  \".join(msg_parts)\n        print(f\"\\n  ERROR: {message}\")\n        raise RebuildPartialError(\n            message,\n            partial_counts=partial,\n            failed_collection=collection_name,\n            dest_palace=dest_palace,\n            archive_path=archive_path,\n        ) from exc\n\n    return upserted\n\n\ndef extract_via_sqlite(palace_path: str, collection_name: str) -> Iterator[tuple[str, str, dict]]:\n    \"\"\"Yield ``(embedding_id, document, metadata)`` for every row in\n    ``collection_name``'s metadata segment by reading ``chroma.sqlite3``\n    directly.\n\n    Bypasses the chromadb client entirely — never opens a\n    ``PersistentClient``, never imports hnswlib, never invokes the\n    HNSW segment writer. This is the recovery path for palaces where","sourceCodeStart":1440,"sourceCodeEnd":1476,"githubUrl":"https://github.com/MemPalace/mempalace/blob/06cb6987f02610784fefbad4b2bd5d026d164ba6/mempalace/repair.py#L1440-L1476","documentation":"Error \"Upsert failed in collection {collection_name!r} after {upserted} rows: {exc!r}\" thrown in MemPalace/mempalace.","triggerScenarios":"Thrown at mempalace/repair.py:1458 when the library encounters an invalid state.","commonSituations":"Upsert failed mid-batch during repair re-upload.","solutions":["Inspect the underlying upsert error; the partial batch was already applied, re-run to continue"],"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"}