{"record":{"id":"6ba72b89b418446f","repo":"MemPalace/mempalace","slug":"add-ids-must-be-unique","errorCode":null,"errorMessage":"add ids must be unique","messagePattern":"add ids must be unique","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"mempalace/backends/milvus.py","lineNumber":534,"sourceCode":"                raise ValueError(\n                    f\"row {idx}: document byte length {document_bytes} exceeds \"\n                    f\"Milvus VARCHAR limit {DOCUMENT_MAX_LENGTH}; chunk before storing\"\n                )\n            row = {\n                FIELD_ID: doc_id,\n                FIELD_DOCUMENT: document,\n                FIELD_METADATA: _jsonable_metadata(metadata),\n                FIELD_VECTOR: vector,\n            }\n            row.update(row[FIELD_METADATA])\n            rows.append(row)\n        return rows, dimension\n\n    def add(self, *, documents, ids, metadatas=None, embeddings=None):\n        if embeddings is None:\n            raise ValueError(\"milvus requires explicit embeddings\")\n        if len(set(ids)) != len(ids):\n            raise ValueError(\"add ids must be unique\")\n        rows, dimension = self._prepare_rows(\n            documents=documents,\n            ids=ids,\n            metadatas=metadatas,\n            embeddings=embeddings,\n        )\n        if not rows:\n            return\n        if self._remote_exists():\n            existing = self.get(ids=list(ids), include=[])\n            if existing.ids:\n                raise ValueError(f\"ids already exist in milvus collection: {existing.ids}\")\n        self._ensure_remote_collection(dimension)\n        self._client.insert(collection_name=self._remote_collection, data=rows)\n        self._backend._write_marker(self._palace, self._config)\n\n    def upsert(self, *, documents, ids, metadatas=None, embeddings=None):\n        if embeddings is None:","sourceCodeStart":516,"sourceCodeEnd":552,"githubUrl":"https://github.com/MemPalace/mempalace/blob/06cb6987f02610784fefbad4b2bd5d026d164ba6/mempalace/backends/milvus.py#L516-L552","documentation":"Error \"add ids must be unique\" thrown in MemPalace/mempalace.","triggerScenarios":"Thrown at mempalace/backends/milvus.py:534 when the library encounters an invalid state.","commonSituations":"Upstream chunker produced colliding drawer ids within a single batch.","solutions":["Deduplicate the ids list before calling add; each id may appear only once"],"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"}