{"record":{"id":"aa8c7a88dd6720b6","repo":"MemPalace/mempalace","slug":"qdrant-collection-self-collection-name-r-expect-aa8c7a","errorCode":null,"errorMessage":"qdrant collection {self._collection_name!r} expects embedding dimension {remote_dim}, got {dimension}","messagePattern":"qdrant collection (.+?) expects embedding dimension (.+?), got (.+?)","errorType":"exception","errorClass":"DimensionMismatchError","httpStatus":null,"severity":"error","filePath":"mempalace/backends/qdrant.py","lineNumber":759,"sourceCode":"        with self._lock:\n            self._ensure_open()\n            if self._known_dimension is not None:\n                if self._known_dimension != dimension:\n                    raise DimensionMismatchError(\n                        f\"qdrant collection {self._collection_name!r} expects \"\n                        f\"embedding dimension {self._known_dimension}, got {dimension}\"\n                    )\n                return\n            if not self._remote_exists():\n                self._client.create_collection(self._remote_collection, dimension)\n                self._client.create_payload_index(\n                    self._remote_collection, _PAYLOAD_DOCUMENT, \"text\"\n                )\n                self._known_dimension = dimension\n                return\n            remote_dim = self._remote_dimension()\n            if remote_dim is not None and remote_dim != dimension:\n                raise DimensionMismatchError(\n                    f\"qdrant collection {self._collection_name!r} expects \"\n                    f\"embedding dimension {remote_dim}, got {dimension}\"\n                )\n            self._known_dimension = remote_dim or dimension\n\n    def _scroll_all(\n        self,\n        *,\n        qdrant_filter: Optional[dict] = None,\n        with_vector: bool = False,\n    ) -> list[dict]:\n        self._ensure_open()\n        if not self._remote_exists():\n            if self._marker_exists():\n                raise CollectionNotInitializedError(self._collection_name)\n            return []\n        rows = []\n        offset = None","sourceCodeStart":741,"sourceCodeEnd":777,"githubUrl":"https://github.com/MemPalace/mempalace/blob/06cb6987f02610784fefbad4b2bd5d026d164ba6/mempalace/backends/qdrant.py#L741-L777","documentation":"Raised by _ensure_remote_collection() when the remote Qdrant collection already exists (possibly created by another process or an earlier session) and its stored vector size differs from the dimension of the batch being written. This is the cross-process variant of the known-dimension check: it queries the server's collection config and compares sizes.","triggerScenarios":"Process A created the collection at 768 dims; process B (or the same process after a restart, before _known_dimension was cached) calls upsert with 384-dim embeddings. Also when someone manually recreated the collection in Qdrant with a different size, or a different palace points at the same remote collection name.","commonSituations":"Embedding model changed between sessions; multiple machines/processes sharing one Qdrant server with different model configs; manual collection recreation in the Qdrant dashboard; restoring a Qdrant volume from another setup.","solutions":["Inspect the remote collection: GET /collections/<name> and read result.config.params.vectors.size","Align your embed model with that size, or migrate: create a new collection with the new model and re-ingest","If the remote collection is stale/wrong, delete it in Qdrant AND remove the local marker so the backend recreates it","Ensure every client of the shared Qdrant server pins the same embedding model via embedder identity"],"exampleFix":"# before\n# remote collection exists at 768; embedding with 384-dim model:\ncol.upsert(documents=docs, ids=ids, embeddings=embed384)  # DimensionMismatchError\n# after\nembed768 = [model_768.embed(d) for d in docs]\ncol.upsert(documents=docs, ids=ids, embeddings=embed768)","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"from mempalace.backends.base import DimensionMismatchError\ntry:\n    collection.upsert(...)\nexcept DimensionMismatchError as e:\n    remote_size = collection._remote_dimension()  # decide: re-embed or revert model","preventionTips":["Treat shared Qdrant servers as single-model: pin the embed model in config for every client","After any manual server-side collection change, verify size matches before writing","Alert on this error in CI ingest jobs — it means config drift across processes"],"tags":["dimension-mismatch","qdrant","embeddings","multi-process"],"backgroundTag":null,"analyzedSha":"06cb6987f02610784fefbad4b2bd5d026d164ba6","analyzedAt":"2026-08-15T03:03:36.213Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}