qdrant
qdrant copied to clipboard
collection_exists returns 404 due to wrong route instead of validating invalid names
Description
When calling collection_exists with invalid collection names (such as empty string or control characters), the client constructs an incorrect request path like:
/collections//exists
This leads the server to return:
404 Not Found
{"status":{"error":"Not found: Collection `exists` doesn't exist!"}}
This is not a genuine “not found” error, but a parameter validation issue. The request should have been rejected before reaching the REST route.
🔬 Reproduction Code
from qdrant_client import QdrantClient
client = QdrantClient(url="http://localhost:6333")
for name in ["", "\t", "\n"]:
try:
client.collection_exists(collection_name=name)
except Exception as e:
print(f"{repr(name)} -> {type(e).__name__}: {e}")
🧩 Current Behavior
- The SDK/server generates
/collections//existsfor invalid names. - The server responds with
404and message:"Collection \existsdoesn't exist!"
✅ Expected Behavior
- Invalid collection names (empty or control characters) should not reach the route handler.
- SDK or server should validate input and return a clear error response:
- HTTP 400 Bad Request, or
- HTTP 422 Unprocessable Entity
- The error message should explicitly state that the
collection_nameis invalid, rather than implying a missing"exists"collection.
💡 Suggested Fix
- Option A (SDK level):
Validate
collection_namebefore sending the request and raise aValueErrorif invalid. - Option B (Server level):
Validate path parameters and return
400/422with an appropriate error message ("Invalid collection name").
🧪 Environment
| Component | Version / Value |
|---|---|
| Qdrant | v1.15.5 |
| Python SDK | qdrant-client==1.14.2 |
| Endpoint | http://localhost:6333 |
I’ve opened a PR #7709 to fix this