BerriAI/litellm · error · Exception

collection_name must be provided, passed None

Error message

collection_name must be provided, passed None

What it means

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.

Source

Thrown at litellm/caching/qdrant_semantic_cache.py:51

        self,
        qdrant_api_base=None,
        qdrant_api_key=None,
        collection_name=None,
        similarity_threshold=None,
        quantization_config=None,
        embedding_model="text-embedding-ada-002",
        host_type=None,
        vector_size=None,
    ):
        from litellm.llms.custom_httpx.http_handler import (
            _get_httpx_client,
            get_async_httpx_client,
            httpxSpecialProvider,
        )
        from litellm.secret_managers.main import get_secret_str

        if collection_name is None:
            raise Exception("collection_name must be provided, passed None")

        self.collection_name = collection_name
        print_verbose(f"qdrant semantic-cache initializing COLLECTION - {self.collection_name}")

        if similarity_threshold is None:
            raise Exception("similarity_threshold must be provided, passed None")
        self.similarity_threshold = similarity_threshold
        self.embedding_model = embedding_model
        self.vector_size = vector_size if vector_size is not None else QDRANT_VECTOR_SIZE
        headers = {}

        # check if defined as os.environ/ variable
        if qdrant_api_base:
            if isinstance(qdrant_api_base, str) and qdrant_api_base.startswith("os.environ/"):
                qdrant_api_base = get_secret_str(qdrant_api_base)
        if qdrant_api_key:
            if isinstance(qdrant_api_key, str) and qdrant_api_key.startswith("os.environ/"):
                qdrant_api_key = get_secret_str(qdrant_api_key)

View on GitHub (pinned to 6c2dcb801b)

Solutions

  1. Pass an explicit collection name, e.g. QdrantSemanticCache(collection_name='litellm-semantic-cache', similarity_threshold=0.8, qdrant_api_base=..., qdrant_api_key=...)
  2. If configuring via litellm proxy YAML, verify the cache block includes collection_name: my-collection
  3. Check for typos in the kwarg name when forwarding **kwargs from your own config loader

Example fix

# before
cache = QdrantSemanticCache(similarity_threshold=0.8, qdrant_api_base=url)

# after
cache = QdrantSemanticCache(collection_name='litellm-semantic-cache', similarity_threshold=0.8, qdrant_api_base=url)
Defensive patterns

Strategy: validation

Validate before calling

from litellm.caching.qdrant_semantic_cache import QdrantSemanticCache

def build_qdrant_cache(cfg: dict) -> QdrantSemanticCache:
    if not cfg.get('collection_name'):
        raise ValueError('qdrant semantic cache requires collection_name in config')
    return QdrantSemanticCache(**cfg)

Try / catch

try:
    cache = QdrantSemanticCache(**cfg)
except Exception as e:
    if 'collection_name must be provided' in str(e):
        raise ValueError(f'Cache misconfigured: {e}') from e
    raise

Prevention

When it happens

Trigger: 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').

Common situations: 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.

Related errors


AI-assisted analysis of BerriAI/litellm@6c2dcb801b (2026-08-15). Data as JSON: /api/errors/35bab968542ec5bf. Report an issue: GitHub.