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

  1. Verify Qdrant is reachable: curl http://<host>:<port>/collections from the same machine
  2. Fix the URL/port in the backend config (REST API is typically 6333, not the gRPC port 6334)
  3. Start the server: docker run -p 6333:6333 qdrant/qdrant or restart the service
  4. For TLS issues, install a trusted cert or point at the http endpoint; for transient drops, retry the operation (upsert is idempotent by id)
  5. 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

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


AI-assisted analysis of MemPalace/mempalace@06cb6987f0 (2026-08-15). Data as JSON: /api/errors/c17fd81666d707da. Report an issue: GitHub.