{"record":{"id":"3062d1f01e713479","repo":"cocoindex-io/cocoindex","slug":"qdrant-collection-schema-must-declare-at-least-one","errorCode":null,"errorMessage":"Qdrant collection schema must declare at least one vector","messagePattern":"Qdrant collection schema must declare at least one vector","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/cocoindex/connectors/qdrant/_target.py","lineNumber":220,"sourceCode":"                'e.g. vectors={\"sparse\": QdrantSparseVectorDef()}'\n            )\n        elif isinstance(vectors, dict):\n            if not vectors:\n                raise ValueError(\"Qdrant named vectors must not be empty\")\n            _validate_vector_names(vectors.keys(), \"vector\")\n            resolved_entries: dict[\n                str, _ResolvedQdrantVectorDef | _ResolvedQdrantSparseVectorDef\n            ] = {}\n            for name, vector_def in vectors.items():\n                if isinstance(vector_def, QdrantVectorDef):\n                    resolved_entries[name] = await _resolve_vector_def(vector_def)\n                elif isinstance(vector_def, QdrantSparseVectorDef):\n                    resolved_entries[name] = _resolve_sparse_vector_def(vector_def)\n                else:\n                    raise ValueError(f\"Invalid vector definition: {vector_def}\")\n            resolved = _ResolvedQdrantNamedVectorsDef(vectors=resolved_entries)\n        elif vectors is None:\n            raise ValueError(\n                \"Qdrant collection schema must declare at least one vector\"\n            )\n        else:\n            raise ValueError(f\"Invalid vector definition: {vectors}\")\n        return cls(resolved)\n\n    @property\n    def vectors(\n        self,\n    ) -> _ResolvedQdrantVectorDef | _ResolvedQdrantNamedVectorsDef:\n        \"\"\"Get vector definitions (all VectorSchemaProviders resolved).\"\"\"\n        return self._vectors\n\n\nclass _PointAction(NamedTuple):\n    point_id: _PointId\n    point: qdrant_models.PointStruct | None\n","sourceCodeStart":202,"sourceCodeEnd":238,"githubUrl":"https://github.com/cocoindex-io/cocoindex/blob/e84aa99b3292c5270a4b313b2a7137ad9ce8ab3b/python/cocoindex/connectors/qdrant/_target.py#L202-L238","documentation":"Raised in `create` when `vectors=None`. A Qdrant collection schema must declare at least one vector (dense or sparse); omitting vectors entirely leaves the collection without a vector definition, which this connector forbids.","triggerScenarios":"Calling collection `create(...)` without the `vectors` argument or with `vectors=None`.","commonSituations":"Creating a non-vector collection through the vector-collection API; forgetting the argument after refactoring; conditionally built code paths where vectors were dropped.","solutions":["Pass at least one vector definition, e.g. `vectors=QdrantVectorDef(dimension=768, distance=QdrantDistance.COSINE)` or a named dict.","If a truly vector-less Qdrant collection is needed, create it directly with qdrant_client instead of this schema-based connector.","Check the code path that leaves `vectors` unset and make it mandatory."],"exampleFix":"// before\ncreate(collection=\"docs\")\n// after\ncreate(collection=\"docs\", vectors=QdrantVectorDef(dimension=768, distance=QdrantDistance.COSINE))","handlingStrategy":"validation","validationCode":"def require_vectors_arg(vectors) -> None:\n    if vectors is None:\n        raise ValueError(\"vectors must be provided\")","typeGuard":"from typing import assert_never\ndef has_vector_decl(v) -> bool:\n    return v is not None","tryCatchPattern":"try:\n    collection = await QdrantCollection.create(..., vectors=vectors)\nexcept ValueError as e:\n    if \"at least one vector\" in str(e):\n        logger.error(\"vectors=None passed; supply a vector definition\")\n    else:\n        raise","preventionTips":["Make vectors a required keyword in wrapper functions around create.","Provide a default vector definition constant for common dense embeddings.","Don't route non-vector collections through the vector collection API."],"tags":["qdrant","vectors","missing-argument"],"backgroundTag":"missing-required-argument","analyzedSha":"e84aa99b3292c5270a4b313b2a7137ad9ce8ab3b","analyzedAt":"2026-09-08T15:59:19.997Z","contentChangedAt":"2026-09-08T15:59:19.997Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}