BerriAI/litellm · error · ValueError

Qdrant url must be provided

Error message

Qdrant url must be provided

What it means

QdrantSemanticCache could not resolve a Qdrant endpoint: qdrant_api_base was not passed (or did not resolve via os.environ/ lookup) and the QDRANT_URL environment variable is unset, so there is no server to create or query collections on.

Solutions

  1. Provide the Qdrant instance URL via the qdrant_url parameter or the QDRANT_URL environment variable.
  2. Verify the URL points to a reachable Qdrant server, e.g. http://localhost:6333.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at litellm/caching/qdrant_semantic_cache.py:78 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/2970fa91389b90d0. Report an issue: GitHub.

Appendix: source

Thrown at litellm/caching/qdrant_semantic_cache.py:78

        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)

        qdrant_api_base = qdrant_api_base or os.getenv("QDRANT_URL") or os.getenv("QDRANT_API_BASE")
        qdrant_api_key = qdrant_api_key or os.getenv("QDRANT_API_KEY")
        headers = {"Content-Type": "application/json"}
        if qdrant_api_key:
            headers["api-key"] = qdrant_api_key

        if qdrant_api_base is None:
            raise ValueError("Qdrant url must be provided")

        self.qdrant_api_base = qdrant_api_base
        self.qdrant_api_key = qdrant_api_key
        print_verbose(f"qdrant semantic-cache qdrant_api_base: {self.qdrant_api_base}")

        self.headers = headers

        self.sync_client = _get_httpx_client()
        self.async_client = get_async_httpx_client(llm_provider=httpxSpecialProvider.Caching)

        if quantization_config is None:
            print_verbose("Quantization config is not provided. Default binary quantization will be used.")
        collection_exists: Final = self.sync_client.get(
            url=f"{self.qdrant_api_base}/collections/{self.collection_name}/exists",
            headers=self.headers,
        )
        if collection_exists.status_code != 200:
            raise ValueError(f"Error from qdrant checking if /collections exist {collection_exists.text}")

View on GitHub (pinned to 77b7c6c40c)