{"record":{"id":"df542b38897378dc","repo":"MemPalace/mempalace","slug":"qdrant-requires-explicit-embeddings","errorCode":null,"errorMessage":"qdrant requires explicit embeddings","messagePattern":"qdrant requires explicit embeddings","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"mempalace/backends/qdrant.py","lineNumber":822,"sourceCode":"        rows = self._scroll_all(qdrant_filter=q_filter, with_vector=with_vector)\n        rows = [\n            row\n            for row in rows\n            if (ids is None or row[\"id\"] in set(ids))\n            and _matches_where(row[\"metadata\"], where)\n            and _matches_where_document(row[\"document\"], where_document)\n        ]\n        return rows\n\n    def add(self, *, documents, ids, metadatas=None, embeddings=None):\n        _validate_write_batch(\n            documents=documents,\n            ids=ids,\n            metadatas=metadatas,\n            embeddings=embeddings,\n        )\n        if embeddings is None:\n            raise ValueError(\"qdrant requires explicit embeddings\")\n        if len(set(ids)) != len(ids):\n            raise ValueError(\"add ids must be unique\")\n        existing = self.get(ids=list(ids), include=[])\n        if existing.ids:\n            raise ValueError(f\"ids already exist in qdrant collection: {existing.ids}\")\n        self.upsert(documents=documents, ids=ids, metadatas=metadatas, embeddings=embeddings)\n\n    def upsert(self, *, documents, ids, metadatas=None, embeddings=None):\n        _validate_write_batch(\n            documents=documents,\n            ids=ids,\n            metadatas=metadatas,\n            embeddings=embeddings,\n        )\n        if embeddings is None:\n            raise ValueError(\"qdrant requires explicit embeddings\")\n        vectors, dimension = _normalize_vectors(embeddings)\n        self._ensure_remote_collection(dimension)","sourceCodeStart":804,"sourceCodeEnd":840,"githubUrl":"https://github.com/MemPalace/mempalace/blob/06cb6987f02610784fefbad4b2bd5d026d164ba6/mempalace/backends/qdrant.py#L804-L840","documentation":"Raised by QdrantCollection.add() when embeddings is None. Unlike the ChromaDB default backend (which can embed internally), this minimal Qdrant REST backend has no built-in embedder, so callers must supply vectors explicitly. The message points users to the palace.get_collection wrapper, which injects the configured local embedder.","triggerScenarios":"Calling raw collection.add(documents=..., ids=...) with no embeddings, the way you would with default Chroma. Also if a wrapper that normally computes embeddings passes embeddings=None through.","commonSituations":"Porting code from the Chroma backend to Qdrant; using a raw collection handle from backend.get_collection() instead of palace.get_collection(); the wrapper's embedder returned None due to a model-load failure.","solutions":["Use palace.get_collection(...) which wraps add() and computes embeddings via the configured local model","Or pass embeddings explicitly: embeddings=[embed(d) for d in documents]","Verify the configured embedder (Ollama/LM Studio) actually loads and returns vectors — a None return upstream becomes this error","Check the backend docs: this backend deliberately delegates embedding to the caller (local-first design)"],"exampleFix":"# before\ncollection.add(documents=docs, ids=ids)  # ValueError: qdrant requires explicit embeddings\n# after\nfrom mempalace.palace import get_collection  # wrapper injects embedder\ncollection = palace.get_collection(\"notes\")\ncollection.add(documents=docs, ids=ids)","handlingStrategy":"validation","validationCode":"if embeddings is None:\n    embeddings = [embedder.embed(d) for d in documents]  # compute before calling add()","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always obtain collections via palace.get_collection so embedding is injected","Never port Chroma-style add(documents=...) calls verbatim to this backend","Centralize writes through one wrapper function that always supplies embeddings"],"tags":["api-misuse","embeddings","qdrant","wrapper"],"backgroundTag":null,"analyzedSha":"06cb6987f02610784fefbad4b2bd5d026d164ba6","analyzedAt":"2026-08-15T03:03:36.213Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}