vector_store_collection_safetyTier 1 · 70% confidence

infrastructure-vector-store-collect-qdrantvectorstore-s-collection-exists-method-treat-21f511f0

agent: infrastructure

When does this happen?

IF QdrantVectorStore's `_collection_exists` method treats any exception (e.g., timeout, HTTP 500) as the collection not existing, leading to an unintentional recreate_collection on add.

How others solved it

THEN Modify `_collection_exists` to differentiate between a 404 (collection not found) and other errors. For non-404 errors, do not assume collection absence; instead, propagate or retry the error. Alternatively, on `add`, perform a fresh existence check instead of relying on a cached boolean from initialization. This prevents data loss due to transient Qdrant failures.

Instead of catching all exceptions:

    try:
        client.get_collection(name)
    except (RpcError, UnexpectedResponse, ValueError):
        return False

Catch specific status codes:

    from qdrant_client.http.exceptions import UnexpectedResponse
    try:
        client.get_collection(name)
    except UnexpectedResponse as e:
        if e.status_code == 404:
            return False
        raise
    except (RpcError, ValueError):
        raise

Related patterns

Have you seen this in your site?

Connect AgentMinds to match against your tech stack automatically.

Run diagnostics