zeroclaw-labs/zeroclaw · error

Qdrant collection creation failed ({status}): {text}

Error message

Qdrant collection creation failed ({status}): {text}

What it means

QdrantMemory::ensure_collection first GETs /collections/{name}; on 404 it PUTs a create request with {"vectors":{"size":<embedder dims>,"distance":"Cosine"}}. This error means Qdrant answered that PUT with a non-2xx status; the status code and response body are embedded in the message. It fires from QdrantMemory::new (eager init) or lazily on the first memory operation after new_lazy.

Source

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

                "size": dims,
                "distance": "Cosine"
            }
        });

        let resp = self
            .request(
                reqwest::Method::PUT,
                &format!("/collections/{}", self.collection),
            )
            .json(&create_body)
            .send()
            .await
            .context("failed to create Qdrant collection")?;

        if !resp.status().is_success() {
            let status = resp.status();
            let text = resp.text().await.unwrap_or_default();
            anyhow::bail!("Qdrant collection creation failed ({status}): {text}");
        }

        ::zeroclaw_log::record!(
            INFO,
            ::zeroclaw_log::Event::new(module_path!(), ::zeroclaw_log::Action::Note),
            &format!(
                "Created Qdrant collection '{}' with {} dimensions",
                self.collection, dims
            )
        );

        Ok(())
    }

    async fn migrate_session_ids_to_sanitized(&self) -> Result<()> {
        let mut seen: HashSet<String> = HashSet::new();
        let mut next_offset: Option<serde_json::Value> = None;

View on GitHub (pinned to 88bb9c8533)

Solutions

  1. Decode the status in the message: on 409 the collection now exists, so simply retry construction/startup; the initial GET check will succeed
  2. On 401/403, set the correct api_key under [memory.qdrant] in zeroclaw.toml
  3. On 400, rename the collection to lowercase letters, digits, hyphens and underscores (Qdrant naming rules)
  4. On 5xx, wait until GET {url}/readyz returns ok, verify the URL targets the REST endpoint (default http://localhost:6333), then retry

Example fix

# before
[memory.qdrant]
url = "http://localhost:6333"
collection = "ZeroClaw Memory"
api_key = ""

# after
[memory.qdrant]
url = "http://localhost:6333"
collection = "zeroclaw-memory"
api_key = "<qdrant-cloud-key>"
Defensive patterns

Strategy: retry

Validate before calling

let resp = client.get(format!("{url}/collections/{collection}")).send().await?;
if !resp.status().is_success() && resp.status().as_u16() != 404 { /* fix url / api-key before constructing QdrantMemory */ }

Try / catch

match QdrantMemory::new(alias, url, col, key, embedder).await {
    Ok(m) => m,
    Err(e) if e.to_string().starts_with("Qdrant collection creation failed (409") => {
        QdrantMemory::new(alias, url, col, key, embedder).await? // created concurrently; GET now succeeds
    }
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: PUT /collections/{collection} returning 409 (another process created the collection between the 404 check and the PUT), 400 (invalid collection name or vector parameters), 401/403 (missing/wrong api-key against an authenticated Qdrant), or 5xx (Qdrant starting up or under maintenance).

Common situations: Multiple zeroclaw instances booting against a fresh Qdrant and racing to create the collection; Qdrant Cloud with a wrong API key; collection names with uppercase letters or spaces that violate Qdrant naming rules; memory.qdrant.url pointing at the dashboard port (6334) instead of the REST port (6333); a Qdrant container restarting while agents connect.

Related errors


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