stanford-oval/storm · error · ValueError

Error occurs when connecting to the server: {e}

Error message

Error occurs when connecting to the server: {e}

What it means

Raised by QdrantVectorStoreManager._init_online_vector_db when QdrantClient(url, api_key) construction or the subsequent _check_create_collection call throws any exception — network/DNS failure, TLS error, 401 from a bad key, or an invalid URL. The original exception's message is interpolated into a generic ValueError, and (notably) the `from e` cause chain is dropped.

Source

Thrown at knowledge_storm/utils.py:127

        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

        """Initialize the Qdrant client that is connected to an offline vector store with the given vector store folder path.

        Args:
            vector_store_path (str): Path to the vector store.
        """
        if vector_store_path is None:
            raise ValueError("Please provide a folder path.")

        try:
            client = QdrantClient(path=vector_store_path)
            return QdrantVectorStoreManager._check_create_collection(

View on GitHub (pinned to fb951af774)

Solutions

  1. Check the underlying service: curl http(s)://<url>/collections or open the URL in a browser to confirm Qdrant is reachable
  2. Fix the endpoint scheme/port (https + :6333 for Qdrant Cloud; http://localhost:6333 for local Docker)
  3. Verify the API key is current and matches the cluster (Qdrant Cloud dashboard > API keys)
  4. Start local Qdrant if using it: docker run -p 6333:6333 qdrant/qdrant

Example fix

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

# after (verify connectivity first, then retry with a live cluster)
# curl https://xyz.cloud.qdrant.io:6333/collections -H "api-key: $KEY"
store = QdrantVectorStoreManager.create_or_update_vector_store(url="https://xyz.cloud.qdrant.io:6333", online_mode=True, api_key=KEY, model=model, collection_name="c")
Defensive patterns

Strategy: try-catch

Validate before calling

import requests

def qdrant_reachable(url, api_key=None):
    try:
        r = requests.get(f"{url.rstrip('/')}/collections", headers={"api-key": api_key} if api_key else {}, timeout=5)
        return r.status_code == 200
    except requests.RequestException:
        return False

assert qdrant_reachable(URL, KEY), "Qdrant server unreachable before initializing"

Try / catch

try:
    store = QdrantVectorStoreManager.create_or_update_vector_store(url=URL, online_mode=True, api_key=KEY, model=m, collection_name=c)
except ValueError as e:
    msg = str(e)
    if "connecting to the server" in msg:
        # inspect msg for the root cause (auth, DNS, TLS) and retry after fixing
        if "401" in msg or "Unauthorized" in msg:
            raise SystemExit("Bad Qdrant API key")
        raise SystemExit(f"Qdrant unreachable: {msg}")
    raise

Prevention

When it happens

Trigger: Calling create_or_update_vector_store(online_mode=True, ...) or _init_online_vector_db with a reachable-check failing: wrong port, mistyped hostname, Qdrant Cloud cluster paused/deleted, invalid API key causing an auth error, or an HTTPS/ingress issue. Any exception inside the try block is re-wrapped as this ValueError.

Common situations: Qdrant Cloud cluster is paused or its free tier expired; local Docker Qdrant not running (localhost:6333 refused); typo'd URL or using http against an https-only endpoint; rotated API key not updated in env; the lost exception chaining makes the real cause harder to see, prompting developers to debug the wrapper instead of the underlying connection error.

Related errors


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