stanford-oval/storm · error · ValueError

Please provide an api key.

Error message

Please provide an api key.

What it means

Raised by QdrantVectorStoreManager._init_online_vector_db when no API key is available for the (remote/cloud) Qdrant server: the api_key argument is None and the QDRANT_API_KEY environment variable is unset. Remote Qdrant endpoints (especially Qdrant Cloud) require an API key, so the manager refuses to proceed without one.

Source

Thrown at knowledge_storm/utils.py:116

                collection_name=collection_name,
                embeddings=model,
            )

    @staticmethod
    def _init_online_vector_db(
        url: str, api_key: str, collection_name: str, model: "HuggingFaceEmbeddings"
    ):
        from qdrant_client import QdrantClient

        """Initialize the Qdrant client that is connected to an online vector store with the given URL and API key.

        Args:
            url (str): URL of the Qdrant server.
            api_key (str): API key for the Qdrant server.
        """
        if api_key is None:
            if not os.getenv("QDRANT_API_KEY"):
                raise ValueError("Please provide an api key.")
            api_key = os.getenv("QDRANT_API_KEY")
        if url is None:
            raise ValueError("Please provide a url for the Qdrant server.")

        try:
            client = QdrantClient(url=url, api_key=api_key)
            return QdrantVectorStoreManager._check_create_collection(
                client=client, collection_name=collection_name, model=model
            )
        except Exception as e:
            raise ValueError(f"Error occurs when connecting to the server: {e}")

    @staticmethod
    def _init_offline_vector_db(
        vector_store_path: str, collection_name: str, model: "HuggingFaceEmbeddings"
    ):
        from qdrant_client import QdrantClient

View on GitHub (pinned to fb951af774)

Solutions

  1. export QDRANT_API_KEY="<your-qdrant-api-key>"
  2. Or pass the argument: create_or_update_vector_store(..., online_mode=True, api_key=KEY, url=URL)
  3. Load your .env before calling (python-dotenv load_dotenv()) if the key lives in a file

Example fix

# before
store = QdrantVectorStoreManager.create_or_update_vector_store(url="https://xyz.cloud.qdrant.io:6333", online_mode=True, model=model, collection_name="c")

# after
store = QdrantVectorStoreManager.create_or_update_vector_store(url="https://xyz.cloud.qdrant.io:6333", online_mode=True, model=model, collection_name="c", api_key="<key>")
# or: export QDRANT_API_KEY=<key>
Defensive patterns

Strategy: validation

Validate before calling

import os

def has_qdrant_key(explicit=None):
    return bool(explicit or os.getenv("QDRANT_API_KEY"))

assert has_qdrant_key(), "Set QDRANT_API_KEY or pass api_key for online mode"

Try / catch

try:
    store = QdrantVectorStoreManager.create_or_update_vector_store(url=URL, online_mode=True, model=m, collection_name=c)
except ValueError as e:
    if "api key" in str(e):
        raise SystemExit("QDRANT_API_KEY missing; add it to your environment")
    raise

Prevention

When it happens

Trigger: Calling create_or_update_vector_store(..., online_mode=True) or _init_online_vector_db(url=...) with api_key=None while QDRANT_API_KEY is not set. A locally reachable, keyless server still triggers it because the check is unconditional for online mode.

Common situations: Migrating from a local Qdrant (no auth) to Qdrant Cloud and forgetting the key; QDRANT_API_KEY defined in .env but never loaded; CI environment missing the secret; passing an empty-string key, which is falsy and fails the check.

Understand the failure class

Background: "environment variable is not set" and "Missing keys in environment" errors: what missing required env var messages mean and how to fix them — this error's family across 28 libraries.

Related errors


AI-assisted analysis of stanford-oval/storm@fb951af774 (2026-08-28). Data as JSON: /api/errors/09494d35d691881b. Report an issue: GitHub.