stanford-oval/storm · error · ValueError
Qdrant client is not initialized.
Error message
Qdrant client is not initialized.
What it means
Raised by QdrantVectorStoreManager._check_create_collection when the qdrant_client `client` argument is None. The helper assumes it is always handed a live client (created by _init_online_vector_db or _init_offline_vector_db); a None client means initialization upstream failed or the method was called directly without a client.
Source
Thrown at knowledge_storm/utils.py:77
class QdrantVectorStoreManager:
"""
Helper class for managing the Qdrant vector store, can be used with `VectorRM` in rm.py.
Before you initialize `VectorRM`, call `create_or_update_vector_store` to create or update the vector store.
Once you have the vector store, you can initialize `VectorRM` with the vector store path or the Qdrant server URL.
"""
@staticmethod
def _check_create_collection(
client: "QdrantClient", collection_name: str, model: "HuggingFaceEmbeddings"
):
from langchain_qdrant import Qdrant
from qdrant_client import models
"""Check if the Qdrant collection exists and create it if it does not."""
if client is None:
raise ValueError("Qdrant client is not initialized.")
if client.collection_exists(collection_name=f"{collection_name}"):
print(f"Collection {collection_name} exists. Loading the collection...")
return Qdrant(
client=client,
collection_name=collection_name,
embeddings=model,
)
else:
print(
f"Collection {collection_name} does not exist. Creating the collection..."
)
# create the collection
client.create_collection(
collection_name=f"{collection_name}",
vectors_config=models.VectorParams(
size=1024, distance=models.Distance.COSINE
),
)View on GitHub (pinned to fb951af774)
Solutions
- Don't call _check_create_collection directly; use QdrantVectorStoreManager.create_or_update_vector_store(...) or _init_online_vector_db/_init_offline_vector_db which construct the client
- If calling directly, construct and pass a real client: from qdrant_client import QdrantClient; client = QdrantClient(url=..., api_key=...)
- Add a guard/early return upstream if client can legitimately be None in your flow
Example fix
# before store = QdrantVectorStoreManager._check_create_collection(client=None, collection_name="c", model=model) # after from qdrant_client import QdrantClient client = QdrantClient(url="http://localhost:6333") store = QdrantVectorStoreManager._check_create_collection(client=client, collection_name="c", model=model)
Defensive patterns
Strategy: validation
Validate before calling
def make_qdrant_client(url, api_key=None):
from qdrant_client import QdrantClient
client = QdrantClient(url=url, api_key=api_key)
assert client is not None
return client
# then always pass make_qdrant_client(...) instead of a possibly-None variable Try / catch
try:
store = QdrantVectorStoreManager._check_create_collection(client=client, collection_name=c, model=m)
except ValueError as e:
if "not initialized" in str(e):
client = QdrantClient(url=URL, api_key=KEY)
store = QdrantVectorStoreManager._check_create_collection(client=client, collection_name=c, model=m)
else:
raise Prevention
- Never call _check_create_collection directly; use the public create_or_update_vector_store
- Type-annotate helpers as client: QdrantClient (not Optional) so static checkers catch None
- Construct the client immediately before use and assert it is not None
When it happens
Trigger: Calling _check_create_collection(client=None, ...) directly, or via create_or_update_vector_store with an online_mode path where QdrantClient construction failed but None was propagated. Normal callers (_init_online_vector_db, _init_offline_vector_db) build the client first, so this mainly fires on direct/misuse calls.
Common situations: Developer calls the private static helper directly in custom code; a modified fork of utils.py passes None on connection failure; type confusion where a variable holding None is passed instead of the client object.
Related errors
- Please provide an api key.
- Please provide a url for the Qdrant server.
- Error occurs when connecting to the server: {e}
- Qdrant client is not initialized.
- Collection {self.collection_name} does not exist. Please cre
AI-assisted analysis of stanford-oval/storm@fb951af774 (2026-08-28).
Data as JSON: /api/errors/72eaa22798c29ab6.
Report an issue: GitHub.