{"record":{"id":"c9f4e6bfbdce242b","repo":"FoundationAgents/MetaGPT","slug":"please-check-qdrantconnection","errorCode":null,"errorMessage":"please check QdrantConnection.","messagePattern":"please check QdrantConnection\\.","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"metagpt/document_store/qdrant_store.py","lineNumber":37,"sourceCode":"    \"\"\"\n\n    url: str = None\n    host: str = None\n    port: int = None\n    memory: bool = False\n    api_key: str = None\n\n\nclass QdrantStore(BaseStore):\n    def __init__(self, connect: QdrantConnection):\n        if connect.memory:\n            self.client = QdrantClient(\":memory:\")\n        elif connect.url:\n            self.client = QdrantClient(url=connect.url, api_key=connect.api_key)\n        elif connect.host and connect.port:\n            self.client = QdrantClient(host=connect.host, port=connect.port, api_key=connect.api_key)\n        else:\n            raise Exception(\"please check QdrantConnection.\")\n\n    def create_collection(\n        self,\n        collection_name: str,\n        vectors_config: VectorParams,\n        force_recreate=False,\n        **kwargs,\n    ):\n        \"\"\"\n        create a collection\n        Args:\n            collection_name: collection name\n            vectors_config: VectorParams object,detail in https://github.com/qdrant/qdrant-client\n            force_recreate: default is False, if True, will delete exists collection,then create it\n            **kwargs:\n\n        Returns:\n","sourceCodeStart":19,"sourceCodeEnd":55,"githubUrl":"https://github.com/FoundationAgents/MetaGPT/blob/11cdf466d042aece04fc6cfd13b28e1a70341b1f/metagpt/document_store/qdrant_store.py#L19-L55","documentation":"QdrantStore.__init__ tries three connection strategies in order — in-memory (connect.memory), URL (connect.url, optionally with api_key), host+port — and raises when none matches. 'please check QdrantConnection.' means the QdrantConnection model was populated with a combination that satisfies no branch, e.g. only host without port, or only an api_key.","triggerScenarios":"QdrantStore(QdrantConnection(host=\"localhost\")) with no port; QdrantConnection(api_key=...) alone; QdrantConnection(port=6333) without host; QdrantConnection() with all fields None.","commonSituations":"Config files that define qdrant host but rely on a default port the model does not provide; switching from a local Qdrant to Qdrant Cloud and passing only the API key without the https URL; partial YAML/env population where one required key is misspelled.","solutions":["Provide a complete combination: url (e.g. QdrantConnection(url=\"http://localhost:6333\") or the Qdrant Cloud https URL with api_key), or both host AND port, or set memory=True for tests.","For Qdrant Cloud: QdrantConnection(url=\"https://<cluster>.cloud.qdrant.io:6333\", api_key=\"<key>\").","Log the connection object (excluding api_key) before constructing QdrantStore to see exactly which fields are populated."],"exampleFix":"# before\nstore = QdrantStore(QdrantConnection(host=\"localhost\"))  # Exception: please check QdrantConnection.\n\n# after\nstore = QdrantStore(QdrantConnection(host=\"localhost\", port=6333))\n# or cloud:\nstore = QdrantStore(QdrantConnection(url=\"https://xyz.cloud.qdrant.io:6333\", api_key=API_KEY))","handlingStrategy":"validation","validationCode":"def qdrant_connection_valid(c) -> bool:\n    return bool(c.memory or c.url or (c.host and c.port))\n\nif not qdrant_connection_valid(conn):\n    raise ValueError(\"QdrantConnection needs one of: memory=True, url, or host+port\")","typeGuard":"def is_valid_qdrant_connection(c) -> bool:\n    \"\"\"True when QdrantStore.__init__ has a branch that can connect.\"\"\"\n    return bool(getattr(c, \"memory\", None) or getattr(c, \"url\", None) or (getattr(c, \"host\", None) and getattr(c, \"port\", None)))","tryCatchPattern":"try:\n    store = QdrantStore(conn)\nexcept Exception as e:\n    if \"please check QdrantConnection\" in str(e):\n        raise ValueError(\"set QdrantConnection.memory, .url, or .host+.port\") from e\n    raise","preventionTips":["Fill exactly one connection mode: memory for tests, url for cloud, host+port for self-hosted.","Validate the populated config object right after loading YAML/env, before any QdrantStore construction.","Never rely on defaults for port — the model has none; write the port explicitly (6333 for REST, 6334 for gRPC)."],"tags":["python","qdrant","vector-store","configuration"],"backgroundTag":null,"analyzedSha":"11cdf466d042aece04fc6cfd13b28e1a70341b1f","analyzedAt":"2026-08-14T23:20:02.994Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}