{"record":{"id":"707a2ca534a32ca5","repo":"zed-industries/zed","slug":"failed-to-parse-batch-output","errorCode":null,"errorMessage":"Failed to parse batch output: {:?}","messagePattern":"Failed to parse batch output: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/edit_prediction_cli/src/openai_client.rs","lineNumber":267,"sourceCode":"            }\n\n            let output_file_id = batch_status.output_file_id.ok_or_else(|| {\n                anyhow::anyhow!(\"Batch {} completed but has no output file\", batch_id)\n            })?;\n\n            let results_content = batches::download_file(\n                self.http_client.as_ref(),\n                OPEN_AI_API_URL,\n                &self.api_key,\n                &output_file_id,\n            )\n            .await\n            .map_err(|e| {\n                anyhow::anyhow!(\"Failed to download batch results for {}: {:?}\", batch_id, e)\n            })?;\n\n            let results = batches::parse_batch_output(&results_content)\n                .map_err(|e| anyhow::anyhow!(\"Failed to parse batch output: {:?}\", e))?;\n\n            let mut updates: Vec<(String, String, String)> = Vec::new();\n            let mut success_count = 0;\n            let mut error_count = 0;\n\n            for result in results {\n                let request_hash = result\n                    .custom_id\n                    .strip_prefix(\"req_hash_\")\n                    .unwrap_or(&result.custom_id)\n                    .to_string();\n\n                if let Some(response_body) = result.response {\n                    if response_body.status_code == 200 {\n                        let response_json = serde_json::to_string(&response_body.body)?;\n                        updates.push((request_hash, response_json, batch_id.clone()));\n                        success_count += 1;\n                    } else {","sourceCodeStart":249,"sourceCodeEnd":285,"githubUrl":"https://github.com/zed-industries/zed/blob/f4178619acd0d47ea1f76a2025c42962c6d6638c/crates/edit_prediction_cli/src/openai_client.rs#L249-L285","documentation":"In import_batches for the edit prediction CLI: the OpenAI batch output file was downloaded successfully but its contents could not be parsed into per-item results. Indicates the output file format deviated from the expected JSONL batch result schema.","triggerScenarios":"Thrown at crates/edit_prediction_cli/src/openai_client.rs:267 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the wrapped serde error for the malformed field","Re-download or re-generate the batch output"],"exampleFix":null,"handlingStrategy":"try-catch","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"}