{"record":{"id":"97b4d8c7bdb764d2","repo":"MemPalace/mempalace","slug":"ids-already-exist-in-milvus-collection-existing","errorCode":null,"errorMessage":"ids already exist in milvus collection: {existing.ids}","messagePattern":"ids already exist in milvus collection: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"mempalace/backends/milvus.py","lineNumber":546,"sourceCode":"        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:\n            raise ValueError(\"milvus requires explicit embeddings\")\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        self._ensure_remote_collection(dimension)\n        self._client.upsert(collection_name=self._remote_collection, data=rows)\n        self._backend._write_marker(self._palace, self._config)","sourceCodeStart":528,"sourceCodeEnd":564,"githubUrl":"https://github.com/MemPalace/mempalace/blob/06cb6987f02610784fefbad4b2bd5d026d164ba6/mempalace/backends/milvus.py#L528-L564","documentation":"Error \"ids already exist in milvus collection: {existing.ids}\" thrown in MemPalace/mempalace.","triggerScenarios":"Thrown at mempalace/backends/milvus.py:546 when the library encounters an invalid state.","commonSituations":"Re-mining or re-adding drawers that already exist in the collection without upsert semantics.","solutions":["Use update/upsert for existing ids, or delete the existing ids first"],"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"}