{"record":{"id":"807987f14b2d18d9","repo":"stanford-oval/storm","slug":"error-occurs-when-loading-the-vector-store-e-807987","errorCode":null,"errorMessage":"Error occurs when loading the vector store: {e}","messagePattern":"Error occurs when loading the vector store: (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"knowledge_storm/utils.py","lineNumber":149,"sourceCode":"        vector_store_path: str, collection_name: str, model: \"HuggingFaceEmbeddings\"\n    ):\n        from qdrant_client import QdrantClient\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            client = QdrantClient(path=vector_store_path)\n            return QdrantVectorStoreManager._check_create_collection(\n                client=client, collection_name=collection_name, model=model\n            )\n        except Exception as e:\n            raise ValueError(f\"Error occurs when loading the vector store: {e}\")\n\n    @staticmethod\n    def create_or_update_vector_store(\n        collection_name: str,\n        vector_db_mode: str,\n        file_path: str,\n        content_column: str,\n        title_column: str = \"title\",\n        url_column: str = \"url\",\n        desc_column: str = \"description\",\n        batch_size: int = 64,\n        chunk_size: int = 500,\n        chunk_overlap: int = 100,\n        vector_store_path: str = None,\n        url: str = None,\n        qdrant_api_key: str = None,\n        embedding_model: str = \"BAAI/bge-m3\",\n        device: str = \"mps\",","sourceCodeStart":131,"sourceCodeEnd":167,"githubUrl":"https://github.com/stanford-oval/storm/blob/fb951af7744dab086e34962e9bc6fe878e145f83/knowledge_storm/utils.py#L131-L167","documentation":"A catch-all in _init_offline_vector_db wrapping any exception thrown while constructing QdrantClient(path=...) or creating/checking the collection. The original exception text is appended, so the real cause (locked store, corrupt data, permission error, dimension mismatch) is embedded in the message.","triggerScenarios":"Opening an offline Qdrant folder already locked by another process, a corrupted/foreign Qdrant directory, insufficient read/write permissions, or a collection whose vector size differs from the embedding model dimension.","commonSituations":"Two workers/scripts opening the same offline store simultaneously, pointing vector_store_path at a non-empty unrelated directory, or switching embedding models against an existing collection.","solutions":["Read the inner {e} text to identify the real cause before changing anything","If another process holds the store, close it or use server mode ('online') which supports concurrent access","If dimensions changed, delete/rename the old store folder so it is recreated","Verify permissions and that the path is (or can be) an empty Qdrant directory"],"exampleFix":"# before\nqdrant = QdrantVectorStoreManager._init_offline_vector_db('./store', 'c', model)\n# after\nimport shutil\nshutil.rmtree('./store', ignore_errors=True)  # recreate if dimension mismatch/corruption\nqdrant = QdrantVectorStoreManager._init_offline_vector_db('./store', 'c', model)","handlingStrategy":"try-catch","validationCode":"from pathlib import Path\np = Path('./qdrant_store')\nif p.exists() and any(p.iterdir()) and not (p / 'meta.sqlite').exists():\n    print('Warning: folder has non-Qdrant contents')","typeGuard":null,"tryCatchPattern":"try:\n    create_or_update_vector_store(..., vector_db_mode='offline', vector_store_path='./store')\nexcept ValueError as e:\n    msg = str(e)\n    if 'loading the vector store' in msg:\n        # inspect inner cause in msg after the colon\n        log.error('Qdrant init failed: %s', msg.split(':', 1)[-1].strip())\n        raise\n    raise","preventionTips":["Run only one process per offline store folder; switch to online/server mode for concurrency","Keep embedding model fixed per store, or version store folders by model name","Back up or version the store directory before model upgrades"],"tags":["qdrant","offline-store","wrapped-exception","initialization"],"backgroundTag":"database-initialization-failed","analyzedSha":"fb951af7744dab086e34962e9bc6fe878e145f83","analyzedAt":"2026-08-28T11:56:54.780Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}