{"record":{"id":"64d5963fd9548f7c","repo":"zeroclaw-labs/zeroclaw","slug":"qdrant-collection-info-failed-status-text","errorCode":null,"errorMessage":"Qdrant collection info failed ({status}): {text}","messagePattern":"Qdrant collection info failed \\((.+?)\\): (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/zeroclaw-memory/src/qdrant.rs","lineNumber":897,"sourceCode":"            .len())\n    }\n\n    async fn count(&self) -> Result<usize> {\n        self.ensure_initialized().await?;\n\n        let resp = self\n            .request(\n                reqwest::Method::GET,\n                &format!(\"/collections/{}\", self.collection),\n            )\n            .send()\n            .await\n            .context(\"failed to get Qdrant collection info\")?;\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 info failed ({status}): {text}\");\n        }\n\n        let json: serde_json::Value = resp.json().await?;\n\n        let count = json\n            .get(\"result\")\n            .and_then(|r| r.get(\"points_count\"))\n            .and_then(|c| c.as_u64())\n            .unwrap_or(0);\n\n        let count =\n            usize::try_from(count).context(\"Qdrant returned a points count that exceeds usize\")?;\n        Ok(count)\n    }\n\n    async fn health_check(&self) -> bool {\n        let resp = self.request(reqwest::Method::GET, \"/\").send().await;\n","sourceCodeStart":879,"sourceCodeEnd":915,"githubUrl":"https://github.com/zeroclaw-labs/zeroclaw/blob/88bb9c8533fc57ed7a03e36ca7c9ed2bf8336dcc/crates/zeroclaw-memory/src/qdrant.rs#L879-L915","documentation":"count() GETs /collections/{c} and reads result.points_count; purge_session_for_agent() calls it after purging. A non-2xx on that GET raises this error.","triggerScenarios":"404 collection deleted after init; 401/403 bad key; 503 while Qdrant is resharding or optimizing segments.","commonSituations":"A post-purge stats call hitting a collection that ops just dropped; api-key rotation; Qdrant returning 503 during optimizer runs.","solutions":["Verify collection presence and key with curl","If dropped: recreate and restart the process (re-init)","503: retry after optimization completes (check the collection status field)","Treat count as advisory at the call site so a failed count doesn't discard the purge result"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":"fn is_qdrant_collection_info_error(e: &anyhow::Error) -> bool {\n    e.to_string().starts_with(\"Qdrant collection info failed\")\n}","tryCatchPattern":"let n = match memory.count().await {\n    Ok(n) => n,\n    Err(e) if is_qdrant_collection_info_error(&e) => 0, // stats are advisory; keep the purge result\n    Err(e) => return Err(e),\n};","preventionTips":["Treat count() as advisory; never let its failure discard a purge result","Recheck collection presence after Qdrant maintenance windows","Retry once on 503 while optimizers run"],"tags":["qdrant","collection-info","count","http-status","rust"],"backgroundTag":"qdrant-api-error","analyzedSha":"88bb9c8533fc57ed7a03e36ca7c9ed2bf8336dcc","analyzedAt":"2026-08-23T01:07:41.857Z","schemaVersion":2},"datasetVersion":"2026-08-23T08:06:27.607Z"}