BerriAI/litellm · error · Exception

Error while creating new collection

Error message

Error while creating new collection

What it means

The PUT request that creates the Qdrant collection (with vector size, Cosine distance and quantization config) failed or returned a falsy result, so the semantic cache could not establish its backing collection.

Solutions

  1. Check Qdrant server logs for the collection creation failure (permissions, storage, or name conflict).
  2. Delete any conflicting existing collection or use a different collection_name, then retry.
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at litellm/caching/qdrant_semantic_cache.py:144 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18). Data as JSON: /api/errors/f4e16adf596afbb0. Report an issue: GitHub.

Appendix: source

Thrown at litellm/caching/qdrant_semantic_cache.py:144

            new_collection_status: Final = self.sync_client.put(
                url=f"{self.qdrant_api_base}/collections/{self.collection_name}",
                json={
                    "vectors": {"size": self.vector_size, "distance": "Cosine"},
                    "quantization_config": quantization_params,
                },
                headers=self.headers,
            )
            if new_collection_status.json()["result"]:
                collection_details = self.sync_client.get(
                    url=f"{self.qdrant_api_base}/collections/{self.collection_name}",
                    headers=self.headers,
                )
                self.collection_info = collection_details.json()
                print_verbose(f"New collection created.\nCollection details:{self.collection_info}")
                self._ensure_cache_key_payload_index()
            else:
                raise Exception("Error while creating new collection")

    def _get_cache_logic(self, cached_response: Any):
        if cached_response is None:
            return cached_response
        try:
            cached_response = json.loads(cached_response)  # Convert string to dictionary
        except Exception:
            cached_response = ast.literal_eval(cached_response)
        return cached_response

    def _get_qdrant_cache_key_filter(self, key: str) -> dict:
        return {
            "must": [
                {
                    "key": self.CACHE_KEY_FIELD_NAME,
                    "match": {"value": str(key)},
                }
            ]

View on GitHub (pinned to 77b7c6c40c)