{"record":{"id":"6af2c8043cebf8b1","repo":"stanford-oval/storm","slug":"error-occurs-when-loading-the-vector-store-e","errorCode":null,"errorMessage":"Error occurs when loading the vector store: {e}","messagePattern":"Error occurs when loading the vector store: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"knowledge_storm/rm.py","lineNumber":289,"sourceCode":"            raise ValueError(f\"Error occurs when connecting to the server: {e}\")\n\n    def init_offline_vector_db(self, vector_store_path: str):\n        from qdrant_client import QdrantClient\n\n        \"\"\"\n        Initialize the Qdrant client that is connected to an offline vector store with the given vector store folder path.\n\n        Args:\n            vector_store_path (str): Path to the vector store.\n        \"\"\"\n        if vector_store_path is None:\n            raise ValueError(\"Please provide a folder path.\")\n\n        try:\n            self.client = QdrantClient(path=vector_store_path)\n            self._check_collection()\n        except Exception as e:\n            raise ValueError(f\"Error occurs when loading the vector store: {e}\")\n\n    def get_usage_and_reset(self):\n        usage = self.usage\n        self.usage = 0\n\n        return {\"VectorRM\": usage}\n\n    def get_vector_count(self):\n        \"\"\"\n        Get the count of vectors in the collection.\n\n        Returns:\n            int: Number of vectors in the collection.\n        \"\"\"\n        return self.qdrant.client.count(collection_name=self.collection_name)\n\n    def forward(self, query_or_queries: Union[str, List[str]], exclude_urls: List[str]):\n        \"\"\"","sourceCodeStart":271,"sourceCodeEnd":307,"githubUrl":"https://github.com/stanford-oval/storm/blob/fb951af7744dab086e34962e9bc6fe878e145f83/knowledge_storm/rm.py#L271-L307","documentation":"init_offline_vector_db wraps QdrantClient(path=...) and _check_collection in try/except and re-raises anything as ValueError('Error occurs when loading the vector store: {e}'). Typical inner causes: the directory is not a valid Qdrant storage folder, lock contention, or the collection not existing in that path.","triggerScenarios":"Pointing vector_store_path at an empty/nonexistent directory; a directory created by a different (incompatible) Qdrant client version; another process holding the local store's lock (local Qdrant mode allows a single process); or the collection missing in the folder, funnelled through _check_collection.","commonSituations":"Reusing a path where ingestion crashed midway; opening the same offline store from two scripts simultaneously; upgrading qdrant-client and hitting on-disk format incompatibilities; wrong path casing/relative path resolved from a different cwd.","solutions":["Check the appended inner exception for the real cause","Verify the folder contains Qdrant files (collections/ subdir) and was written by the same qdrant-client version","Ensure no other process has the store open — close other clients before loading; delete and rebuild the store if corrupt","Use an absolute path to avoid cwd-dependent resolution"],"exampleFix":"// before\nrm.init_offline_vector_db('./qdrant_missing')  # ValueError: Error occurs when loading the vector store: ...\n// after\nimport os\npath = os.path.abspath('./qdrant')\nassert os.path.isdir(os.path.join(path, 'collections'))\nrm.init_offline_vector_db(path)","handlingStrategy":"validation","validationCode":"import os\nSTORE = os.path.abspath('./qdrant')\nassert os.path.isdir(os.path.join(STORE, 'collections')), f'{STORE} is not a Qdrant store'\nrm.init_offline_vector_db(STORE)","typeGuard":"def is_qdrant_store(path: str) -> bool:\n    import os\n    return os.path.isdir(os.path.join(path, 'collections'))","tryCatchPattern":"try:\n    rm.init_offline_vector_db(STORE)\nexcept ValueError as e:\n    msg = str(e)\n    if 'does not exist' in msg:\n        raise SystemExit('Store valid but collection missing — rebuild ingestion')\n    if 'lock' in msg.lower() or 'another process' in msg.lower():\n        raise SystemExit('Close other processes holding the local store')\n    raise","preventionTips":["Never open the same offline store from two processes; local Qdrant is single-writer","Pin the qdrant-client version used for both ingestion and retrieval to avoid format drift","Keep an ingestion script that can rebuild the store from scratch"],"tags":["python","qdrant","offline-mode","storage","error-wrapping"],"backgroundTag":"local-store-load-failed","analyzedSha":"fb951af7744dab086e34962e9bc6fe878e145f83","analyzedAt":"2026-08-28T11:56:54.780Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}