{"record":{"id":"95d5e8b1191ab6de","repo":"zeroclaw-labs/zeroclaw","slug":"qdrant-collection-creation-failed-status-tex","errorCode":null,"errorMessage":"Qdrant collection creation failed ({status}): {text}","messagePattern":"Qdrant collection creation failed \\((.+?)\\): (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/zeroclaw-memory/src/qdrant.rs","lineNumber":274,"sourceCode":"                \"size\": dims,\n                \"distance\": \"Cosine\"\n            }\n        });\n\n        let resp = self\n            .request(\n                reqwest::Method::PUT,\n                &format!(\"/collections/{}\", self.collection),\n            )\n            .json(&create_body)\n            .send()\n            .await\n            .context(\"failed to create Qdrant collection\")?;\n\n        if !resp.status().is_success() {\n            let status = resp.status();\n            let text = resp.text().await.unwrap_or_default();\n            anyhow::bail!(\"Qdrant collection creation failed ({status}): {text}\");\n        }\n\n        ::zeroclaw_log::record!(\n            INFO,\n            ::zeroclaw_log::Event::new(module_path!(), ::zeroclaw_log::Action::Note),\n            &format!(\n                \"Created Qdrant collection '{}' with {} dimensions\",\n                self.collection, dims\n            )\n        );\n\n        Ok(())\n    }\n\n    async fn migrate_session_ids_to_sanitized(&self) -> Result<()> {\n        let mut seen: HashSet<String> = HashSet::new();\n        let mut next_offset: Option<serde_json::Value> = None;\n","sourceCodeStart":256,"sourceCodeEnd":292,"githubUrl":"https://github.com/zeroclaw-labs/zeroclaw/blob/88bb9c8533fc57ed7a03e36ca7c9ed2bf8336dcc/crates/zeroclaw-memory/src/qdrant.rs#L256-L292","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Decode the status in the message: on 409 the collection now exists, so simply retry construction/startup; the initial GET check will succeed","On 401/403, set the correct api_key under [memory.qdrant] in zeroclaw.toml","On 400, rename the collection to lowercase letters, digits, hyphens and underscores (Qdrant naming rules)","On 5xx, wait until GET {url}/readyz returns ok, verify the URL targets the REST endpoint (default http://localhost:6333), then retry"],"exampleFix":"# before\n[memory.qdrant]\nurl = \"http://localhost:6333\"\ncollection = \"ZeroClaw Memory\"\napi_key = \"\"\n\n# after\n[memory.qdrant]\nurl = \"http://localhost:6333\"\ncollection = \"zeroclaw-memory\"\napi_key = \"<qdrant-cloud-key>\"","handlingStrategy":"retry","validationCode":"let resp = client.get(format!(\"{url}/collections/{collection}\")).send().await?;\nif !resp.status().is_success() && resp.status().as_u16() != 404 { /* fix url / api-key before constructing QdrantMemory */ }","typeGuard":null,"tryCatchPattern":"match QdrantMemory::new(alias, url, col, key, embedder).await {\n    Ok(m) => m,\n    Err(e) if e.to_string().starts_with(\"Qdrant collection creation failed (409\") => {\n        QdrantMemory::new(alias, url, col, key, embedder).await? // created concurrently; GET now succeeds\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Create collections with a single bootstrap owner (init job) instead of racing per-instance creation","Keep collection names lowercase alphanumeric with hyphens/underscores","Point memory.qdrant.url at the REST port (6333), not the dashboard","Supply the api-key via the secrets provider, never inline"],"tags":["qdrant","vector-database","http-status","rust","startup","configuration"],"backgroundTag":"collection-already-exists","analyzedSha":"88bb9c8533fc57ed7a03e36ca7c9ed2bf8336dcc","analyzedAt":"2026-08-23T01:07:41.857Z","schemaVersion":2},"datasetVersion":"2026-08-23T08:06:27.607Z"}