zeroclaw-labs/zeroclaw · error

Qdrant connection failed: {e}

Error message

Qdrant connection failed: {e}

What it means

The HTTP request behind the collection-existence check never completed — reqwest returned a transport error (connection refused, DNS failure, TLS handshake), meaning zeroclaw could not reach Qdrant at all. Raised in ensure_collection during store construction or ensure_initialized; note that with a noop embedder (0 dimensions) the whole check is skipped, so this error implies a real embedder is configured.

Source

Thrown at crates/zeroclaw-memory/src/qdrant.rs:249

            )
            .send()
            .await;

        match resp {
            Ok(r) if r.status().is_success() => {
                // Collection exists
                return Ok(());
            }
            Ok(r) if r.status().as_u16() == 404 => {
                // Collection doesn't exist, create it
            }
            Ok(r) => {
                let status = r.status();
                let text = r.text().await.unwrap_or_default();
                anyhow::bail!("Qdrant collection check failed ({status}): {text}");
            }
            Err(e) => {
                anyhow::bail!("Qdrant connection failed: {e}");
            }
        }

        // Create collection with vector config
        let create_body = serde_json::json!({
            "vectors": {
                "size": dims,
                "distance": "Cosine"
            }
        });

        let resp = self
            .request(
                reqwest::Method::PUT,
                &format!("/collections/{}", self.collection),
            )
            .json(&create_body)
            .send()

View on GitHub (pinned to 88bb9c8533)

Solutions

  1. Reachability-check the URL from the same host: `curl http://<host>:6333/collections` should answer.
  2. Fix `url` in `[storage.qdrant.<alias>]`: correct host, REST port (6333), and scheme; use https with a valid certificate for cloud endpoints.
  3. Start Qdrant (or fix DNS/firewall) so the connection can be established, then restart the service so ensure_collection retries.

Example fix

# before
[storage.qdrant.prod]
url = "http://localhost:6334"  # wrong port (gRPC)

# after
[storage.qdrant.prod]
url = "http://localhost:6333"  # REST port
Defensive patterns

Strategy: retry

Validate before calling

// Cheap reachability probe before constructing the qdrant store
let resp = reqwest::Client::builder()
    .timeout(Duration::from_secs(3))
    .build()?
    .get(format!("{url}/collections"))
    .send()
    .await;
if resp.is_err() {
    anyhow::bail!("qdrant at {url} is unreachable; check host/port/scheme");
}

Try / catch

let mut attempt = 0;
loop {
    attempt += 1;
    match ensure_store(&qdrant_cfg).await {
        Ok(store) => break store,
        Err(e) if e.to_string().contains("Qdrant connection failed") && attempt < 5 => {
            tokio::time::sleep(Duration::from_millis(500 * u64::from(attempt))).await;
        }
        Err(e) => break Err(e),
    }
}

Prevention

When it happens

Trigger: Qdrant not running or listening on another host/port; wrong scheme (https against a plain HTTP port); DNS name not resolving; firewall/network policy dropping the connection — any condition where the GET /collections/{name} request itself errors.

Common situations: Local dev without Qdrant started (localhost:6333 refused); Docker networking mismatches between services; typo'd URLs; TLS mismatch against Qdrant Cloud; the REST URL pointing at the gRPC port.

Related errors


AI-assisted analysis of zeroclaw-labs/zeroclaw@88bb9c8533 (2026-08-23). Data as JSON: /api/errors/57f28efa16f6e2bf. Report an issue: GitHub.