MemPalace/mempalace · error · BackendError
Qdrant request failed: {exc.reason}
Error message
Qdrant request failed: {exc.reason} What it means
Raised by QdrantClient.request() when the underlying urllib request fails at the transport level (urlerror.URLError) — i.e. the HTTP request to the Qdrant server never completed. The exception reason (connection refused, DNS failure, timeout, TLS error) is wrapped in BackendError.
Source
Thrown at mempalace/backends/qdrant.py:400
url = f"{self._config.url}{path}"
if query:
url = f"{url}?{urlparse.urlencode(query)}"
data = None
headers = {"Content-Type": "application/json"}
if self._config.api_key:
headers["api-key"] = self._config.api_key
if body is not None:
data = json.dumps(body, ensure_ascii=False).encode("utf-8")
req = urlrequest.Request(url, data=data, method=method, headers=headers)
try:
with urlrequest.urlopen(req, timeout=self._config.timeout) as resp:
raw = resp.read()
except urlerror.HTTPError as exc:
raw = exc.read()
detail = raw.decode("utf-8", errors="replace") if raw else str(exc)
raise _QdrantHTTPError(exc.code, detail) from exc
except urlerror.URLError as exc:
raise BackendError(f"Qdrant request failed: {exc.reason}") from exc
if not raw:
return {}
try:
return json.loads(raw.decode("utf-8"))
except json.JSONDecodeError as exc:
raise BackendError("Qdrant returned invalid JSON") from exc
def collection_exists(self, collection: str) -> bool:
try:
self.request("GET", f"/collections/{urlparse.quote(collection, safe='')}")
except _QdrantHTTPError as exc:
if exc.status == 404:
return False
raise
return True
def get_collection_info(self, collection: str) -> dict:
return self.request("GET", f"/collections/{urlparse.quote(collection, safe='')}")View on GitHub (pinned to 06cb6987f0)
Solutions
- Verify Qdrant is reachable: curl http://<host>:<port>/collections from the same machine
- Fix the URL/port in the backend config (REST API is typically 6333, not the gRPC port 6334)
- Start the server: docker run -p 6333:6333 qdrant/qdrant or restart the service
- For TLS issues, install a trusted cert or point at the http endpoint; for transient drops, retry the operation (upsert is idempotent by id)
- Wrap collection calls in try/except BackendError and surface a clear 'Qdrant unavailable' message
Example fix
# before backend_config = QdrantConfig(url="http://localhost:6334") # wrong: gRPC port # after backend_config = QdrantConfig(url="http://localhost:6333") # REST API port
Defensive patterns
Strategy: retry
Validate before calling
import socket, urlrequest
def qdrant_up(url, port, timeout=2):
try:
urlrequest.urlopen(f"http://{url}:{port}/", timeout=timeout)
return True
except Exception:
return False Try / catch
from mempalace.backends.base import BackendError
try:
collection.get(ids=["x"])
except BackendError as e:
if "Qdrant request failed" in str(e):
# connection-level failure: check server, then retry after fixing
... Prevention
- Health-check the Qdrant URL at app startup before any writes
- Use the REST port (6333 by default), not gRPC 6334
- Run Qdrant with a persistent volume and a supervised restart policy
- Make upserts idempotent (stable ids) so retries after network errors are safe
When it happens
Trigger: Qdrant server not running or wrong URL/port in backend config, DNS resolution failure for a remote host, TCP connection refused, TLS certificate error on https endpoints, or a network drop mid-request.
Common situations: Qdrant docker container stopped or not started; misconfigured host/port (default gRPC port 6334 used instead of REST 6333); firewall blocking egress; kubernetes pod not ready; TLS self-signed cert rejected by urllib.
Related errors
- Qdrant returned invalid JSON
- embedding dimension must be positive
- qdrant collection {self._collection_name!r} expects embeddin
- qdrant marker remote target does not match current configura
- HTTP {e.code} from {url}: {detail or e.reason}
AI-assisted analysis of MemPalace/mempalace@06cb6987f0 (2026-08-15).
Data as JSON: /api/errors/c17fd81666d707da.
Report an issue: GitHub.