{"record":{"id":"4c8c05f41275260b","repo":"zed-industries/zed","slug":"failed-to-retrieve-batch","errorCode":null,"errorMessage":"Failed to retrieve batch {}: {:?}","messagePattern":"Failed to retrieve batch (.+?): (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/edit_prediction_cli/src/anthropic_client.rs","lineNumber":321,"sourceCode":"        let counts: Vec<i32> = connection.select(\n            sql!(SELECT COUNT(*) FROM cache WHERE batch_id IS NOT NULL AND response IS NULL),\n        )?()?;\n        Ok(counts.into_iter().next().unwrap_or(0) as usize)\n    }\n\n    /// Import batch results from external batch IDs (useful for recovering after database loss)\n    pub async fn import_batches(&self, batch_ids: &[String]) -> Result<()> {\n        for batch_id in batch_ids {\n            log::info!(\"Importing batch {}\", batch_id);\n\n            let batch_status = anthropic::batches::retrieve_batch(\n                self.http_client.as_ref(),\n                ANTHROPIC_API_URL,\n                &self.api_key,\n                batch_id,\n            )\n            .await\n            .map_err(|e| anyhow::anyhow!(\"Failed to retrieve batch {}: {:?}\", batch_id, e))?;\n\n            log::info!(\n                \"Batch {} status: {}\",\n                batch_id,\n                batch_status.processing_status\n            );\n\n            if batch_status.processing_status != \"ended\" {\n                log::warn!(\n                    \"Batch {} is not finished (status: {}), skipping\",\n                    batch_id,\n                    batch_status.processing_status\n                );\n                continue;\n            }\n\n            let results = anthropic::batches::retrieve_batch_results(\n                self.http_client.as_ref(),","sourceCodeStart":303,"sourceCodeEnd":339,"githubUrl":"https://github.com/zed-industries/zed/blob/f4178619acd0d47ea1f76a2025c42962c6d6638c/crates/edit_prediction_cli/src/anthropic_client.rs#L303-L339","documentation":"import_batches calls anthropic::batches::retrieve_batch for each imported batch ID; this error wraps a failed retrieval (network or API error) and names the batch. The collab/eval CLI could not fetch the status of a previously submitted Anthropic batch.","triggerScenarios":"Thrown at crates/edit_prediction_cli/src/anthropic_client.rs:321 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the batch ID exists and belongs to this account","Check network/API status and retry the import"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"f4178619acd0d47ea1f76a2025c42962c6d6638c","analyzedAt":"2026-08-20T19:29:52.058Z","contentChangedAt":"2026-08-20T19:29:52.058Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}