Skip to content

fix(local_qdrant): use collection_exists() instead of get_collections() - #40

Open
mkadrlik wants to merge 1 commit into
ClaudioDrews:mainfrom
mkadrlik:fix/ensure-collection-alias
Open

mkadrlik wants to merge 1 commit into
ClaudioDrews:mainfrom
mkadrlik:fix/ensure-collection-alias

Conversation

@mkadrlik

@mkadrlik mkadrlik commented Oct 3, 2026

Copy link
Copy Markdown

Root Cause

The ensure_collection() function in docker/worker/services/local_qdrant.py used get_collections() to check if a collection exists. However, Qdrant aliases do not appear in get_collections() — only real collection names do.

The logical collection name (knowledge_base) is a Qdrant alias pointing to the real collection (knowledge_base_v2). The old code concluded the collection was missing and called create_collection("knowledge_base"), which raised HTTP 400 (alias already exists) → crash-loop.

Fix

Replace the alias-blind get_collections() check with client.collection_exists(COLLECTION_NAME), which correctly follows aliases.

Evidence

  • Before: RestartCount=2215, crash-loop
  • After: RestartCount=0, container healthy, clean startup logs
  • Soak: 60s clean, zero errors

Diff

Only docker/worker/services/local_qdrant.py changed (13 insertions, 6 deletions).

The logical collection name (e.g. knowledge_base) may be a Qdrant alias
pointing to a real collection (e.g. knowledge_base_v2). get_collections()
only returns real collection names, NOT aliases. The old code would
conclude the collection was missing and call create_collection('knowledge_base')
which raised HTTP 400 (alias already exists) -> crash-loop.

Fix: use client.collection_exists(COLLECTION_NAME) which follows aliases.

Root cause: alias-vs-collection bug causing 2215 restarts.
Evidence: RestartCount 2215->0, container healthy after fix.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant