FoundationAgents/MetaGPT · error · Exception

please check QdrantConnection.

Error message

please check QdrantConnection.

What it means

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.

Source

Thrown at metagpt/document_store/qdrant_store.py:37

    """

    url: str = None
    host: str = None
    port: int = None
    memory: bool = False
    api_key: str = None


class QdrantStore(BaseStore):
    def __init__(self, connect: QdrantConnection):
        if connect.memory:
            self.client = QdrantClient(":memory:")
        elif connect.url:
            self.client = QdrantClient(url=connect.url, api_key=connect.api_key)
        elif connect.host and connect.port:
            self.client = QdrantClient(host=connect.host, port=connect.port, api_key=connect.api_key)
        else:
            raise Exception("please check QdrantConnection.")

    def create_collection(
        self,
        collection_name: str,
        vectors_config: VectorParams,
        force_recreate=False,
        **kwargs,
    ):
        """
        create a collection
        Args:
            collection_name: collection name
            vectors_config: VectorParams object,detail in https://github.com/qdrant/qdrant-client
            force_recreate: default is False, if True, will delete exists collection,then create it
            **kwargs:

        Returns:

View on GitHub (pinned to 11cdf466d0)

Solutions

  1. 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.
  2. For Qdrant Cloud: QdrantConnection(url="https://<cluster>.cloud.qdrant.io:6333", api_key="<key>").
  3. Log the connection object (excluding api_key) before constructing QdrantStore to see exactly which fields are populated.

Example fix

# before
store = QdrantStore(QdrantConnection(host="localhost"))  # Exception: please check QdrantConnection.

# after
store = QdrantStore(QdrantConnection(host="localhost", port=6333))
# or cloud:
store = QdrantStore(QdrantConnection(url="https://xyz.cloud.qdrant.io:6333", api_key=API_KEY))
Defensive patterns

Strategy: validation

Validate before calling

def qdrant_connection_valid(c) -> bool:
    return bool(c.memory or c.url or (c.host and c.port))

if not qdrant_connection_valid(conn):
    raise ValueError("QdrantConnection needs one of: memory=True, url, or host+port")

Type guard

def is_valid_qdrant_connection(c) -> bool:
    """True when QdrantStore.__init__ has a branch that can connect."""
    return bool(getattr(c, "memory", None) or getattr(c, "url", None) or (getattr(c, "host", None) and getattr(c, "port", None)))

Try / catch

try:
    store = QdrantStore(conn)
except Exception as e:
    if "please check QdrantConnection" in str(e):
        raise ValueError("set QdrantConnection.memory, .url, or .host+.port") from e
    raise

Prevention

When it happens

Trigger: QdrantStore(QdrantConnection(host="localhost")) with no port; QdrantConnection(api_key=...) alone; QdrantConnection(port=6333) without host; QdrantConnection() with all fields None.

Common situations: 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.

Related errors


AI-assisted analysis of FoundationAgents/MetaGPT@11cdf466d0 (2026-08-14). Data as JSON: /api/errors/c9f4e6bfbdce242b. Report an issue: GitHub.