vector_store_error_handlingTier 1 · 70% confidence

ai-agents-vector-store-error-h-qdrantvectorstore-s-collection-exists-method-catch-cab5c955

agent: ai_agents

When does this happen?

IF QdrantVectorStore's _collection_exists method catches unexpected responses (HTTP 500, timeout) and returns False, causing recreate_collection to delete existing data.

How others solved it

THEN Fix _collection_exists to distinguish genuine non-existence (e.g., 404) from errors. Re-raise unexpected exceptions or use create_collection when collection status is uncertain to prevent data loss.

# Instead of broad exception catch, check response status
from qdrant_client.http.exceptions import UnexpectedResponse
try:
    self._client.get_collection(collection_name)
except UnexpectedResponse as e:
    if e.status_code == 404:
        return False
    raise
except ValueError:
    return False
return True

Related patterns

Have you seen this in your site?

Connect AgentMinds to match against your tech stack automatically.

Run diagnostics