{"record":{"id":"3b9fca287e00825d","repo":"stanford-oval/storm","slug":"collection-self-collection-name-does-not-exist","errorCode":null,"errorMessage":"Collection {self.collection_name} does not exist. Please create the collection first.","messagePattern":"Collection (.+?) does not exist\\. Please create the collection first\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"knowledge_storm/rm.py","lineNumber":246,"sourceCode":"    def _check_collection(self):\n        from langchain_qdrant import Qdrant\n\n        \"\"\"\n        Check if the Qdrant collection exists and create it if it does not.\n        \"\"\"\n        if self.client is None:\n            raise ValueError(\"Qdrant client is not initialized.\")\n        if self.client.collection_exists(collection_name=f\"{self.collection_name}\"):\n            print(\n                f\"Collection {self.collection_name} exists. Loading the collection...\"\n            )\n            self.qdrant = Qdrant(\n                client=self.client,\n                collection_name=self.collection_name,\n                embeddings=self.model,\n            )\n        else:\n            raise ValueError(\n                f\"Collection {self.collection_name} does not exist. Please create the collection first.\"\n            )\n\n    def init_online_vector_db(self, url: str, api_key: str):\n        from qdrant_client import QdrantClient\n\n        \"\"\"\n        Initialize the Qdrant client that is connected to an online vector store with the given URL and API key.\n\n        Args:\n            url (str): URL of the Qdrant server.\n            api_key (str): API key for the Qdrant server.\n        \"\"\"\n        if api_key is None:\n            if not os.getenv(\"QDRANT_API_KEY\"):\n                raise ValueError(\"Please provide an api key.\")\n            api_key = os.getenv(\"QDRANT_API_KEY\")\n        if url is None:","sourceCodeStart":228,"sourceCodeEnd":264,"githubUrl":"https://github.com/stanford-oval/storm/blob/fb951af7744dab086e34962e9bc6fe878e145f83/knowledge_storm/rm.py#L228-L264","documentation":"When the Qdrant collection exists, VectorRM loads it as a langchain Qdrant retriever; when it does not exist, instead of creating it (despite the docstring), the else branch raises ValueError telling the user to create the collection first. So the vector store must be populated out-of-band before VectorRM can attach to it.","triggerScenarios":"Calling VectorRM(...) with a collection_name that has never been created on the Qdrant server or in the offline path folder, then running init_online_vector_db/init_offline_vector_db which calls _check_collection and finds collection_exists(...) == False.","commonSituations":"Typos in collection_name; pointing at a fresh/empty Qdrant server; pointing vector_store_path at an empty or wrong directory for offline mode; expecting VectorRM to auto-create the collection because of its docstring.","solutions":["Verify the exact collection name on the server (qdrant_client.get_collections()) and fix collection_name","Create and populate the collection beforehand with qdrant_client.create_collection(...) plus an ingestion script using the same embedding model and vector dimension","For offline mode, confirm vector_store_path points at the folder that actually contains the pre-built store"],"exampleFix":"// before\nrm = VectorRM(collection_name='my_col', source='offline', vector_store_path='./qdrant', embedding_model='...')\nrm.init_offline_vector_db('./empty_dir')  # collection missing\n// after\nfrom qdrant_client import QdrantClient\nclient = QdrantClient(path='./qdrant')\nclient.get_collections()  # verify name, create/populate 'my_col' first\nrm.init_offline_vector_db('./qdrant')","handlingStrategy":"validation","validationCode":"from qdrant_client import QdrantClient\nclient = QdrantClient(path='./qdrant')  # or url=..., api_key=...\nnames = [c.name for c in client.get_collections().collections]\nassert 'docs' in names, f'collection docs not found; have {names}'\nrm = VectorRM(collection_name='docs', source='offline', vector_store_path='./qdrant', embedding_model=MODEL)\nrm.init_offline_vector_db('./qdrant')","typeGuard":"def collection_exists(client, name: str) -> bool:\n    return any(c.name == name for c in client.get_collections().collections)","tryCatchPattern":"try:\n    rm.init_offline_vector_db('./qdrant')\nexcept ValueError as e:\n    if 'does not exist' in str(e):\n        client.create_collection(collection_name='docs', vectors_config=Dim(384))  # then ingest\n        raise SystemExit('Collection created empty — run ingestion before retrieval')\n    raise","preventionTips":["Run a startup assertion listing collections before constructing VectorRM","Automate collection creation + ingestion in a setup script so the name can never drift"],"tags":["python","qdrant","vector-database","missing-resource"],"backgroundTag":"collection-not-found","analyzedSha":"fb951af7744dab086e34962e9bc6fe878e145f83","analyzedAt":"2026-08-28T11:56:54.780Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}