{"record":{"id":"35bab968542ec5bf","repo":"BerriAI/litellm","slug":"collection-name-must-be-provided-passed-none","errorCode":null,"errorMessage":"collection_name must be provided, passed None","messagePattern":"collection_name must be provided, passed None","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"litellm/caching/qdrant_semantic_cache.py","lineNumber":51,"sourceCode":"        self,\n        qdrant_api_base=None,\n        qdrant_api_key=None,\n        collection_name=None,\n        similarity_threshold=None,\n        quantization_config=None,\n        embedding_model=\"text-embedding-ada-002\",\n        host_type=None,\n        vector_size=None,\n    ):\n        from litellm.llms.custom_httpx.http_handler import (\n            _get_httpx_client,\n            get_async_httpx_client,\n            httpxSpecialProvider,\n        )\n        from litellm.secret_managers.main import get_secret_str\n\n        if collection_name is None:\n            raise Exception(\"collection_name must be provided, passed None\")\n\n        self.collection_name = collection_name\n        print_verbose(f\"qdrant semantic-cache initializing COLLECTION - {self.collection_name}\")\n\n        if similarity_threshold is None:\n            raise Exception(\"similarity_threshold must be provided, passed None\")\n        self.similarity_threshold = similarity_threshold\n        self.embedding_model = embedding_model\n        self.vector_size = vector_size if vector_size is not None else QDRANT_VECTOR_SIZE\n        headers = {}\n\n        # check if defined as os.environ/ variable\n        if qdrant_api_base:\n            if isinstance(qdrant_api_base, str) and qdrant_api_base.startswith(\"os.environ/\"):\n                qdrant_api_base = get_secret_str(qdrant_api_base)\n        if qdrant_api_key:\n            if isinstance(qdrant_api_key, str) and qdrant_api_key.startswith(\"os.environ/\"):\n                qdrant_api_key = get_secret_str(qdrant_api_key)","sourceCodeStart":33,"sourceCodeEnd":69,"githubUrl":"https://github.com/BerriAI/litellm/blob/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/caching/qdrant_semantic_cache.py#L33-L69","documentation":"QdrantSemanticCache.__init__ requires an explicit collection_name; passing None (or omitting it when there is no default) raises this exception immediately during cache construction. LiteLLM will not auto-generate a Qdrant collection name because the collection is where vectors are stored and queried. This fails before any network call to Qdrant is made.","triggerScenarios":"Instantiating litellm.caching.qdrant_semantic_cache.QdrantSemanticCache(collection_name=None), or constructing the cache from a config dict/YAML where the collection_name key is missing or misspelled (e.g. 'collection' instead of 'collection_name').","commonSituations":"Setting up litellm proxy caching with type='qdrant-semantic' in config.yaml but forgetting the collection_name field; programmatically building the cache from kwargs where the key was never populated.","solutions":["Pass an explicit collection name, e.g. QdrantSemanticCache(collection_name='litellm-semantic-cache', similarity_threshold=0.8, qdrant_api_base=..., qdrant_api_key=...)","If configuring via litellm proxy YAML, verify the cache block includes collection_name: my-collection","Check for typos in the kwarg name when forwarding **kwargs from your own config loader"],"exampleFix":"# before\ncache = QdrantSemanticCache(similarity_threshold=0.8, qdrant_api_base=url)\n\n# after\ncache = QdrantSemanticCache(collection_name='litellm-semantic-cache', similarity_threshold=0.8, qdrant_api_base=url)","handlingStrategy":"validation","validationCode":"from litellm.caching.qdrant_semantic_cache import QdrantSemanticCache\n\ndef build_qdrant_cache(cfg: dict) -> QdrantSemanticCache:\n    if not cfg.get('collection_name'):\n        raise ValueError('qdrant semantic cache requires collection_name in config')\n    return QdrantSemanticCache(**cfg)","typeGuard":null,"tryCatchPattern":"try:\n    cache = QdrantSemanticCache(**cfg)\nexcept Exception as e:\n    if 'collection_name must be provided' in str(e):\n        raise ValueError(f'Cache misconfigured: {e}') from e\n    raise","preventionTips":["Validate cache config dicts at startup, not lazily at first request","Fail fast in CI by constructing all configured caches during deployment smoke tests"],"tags":["qdrant","semantic-cache","configuration","validation"],"backgroundTag":null,"analyzedSha":"6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d","analyzedAt":"2026-08-15T07:12:03.035Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}