{"record":{"id":"759c061f936342bb","repo":"zed-industries/zed","slug":"codestral-api-error","errorCode":null,"errorMessage":"Codestral API error: {} - {}","messagePattern":"Codestral API error: (.+?) - (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/codestral/src/codestral.rs","lineNumber":165,"sourceCode":"        log::debug!(\"Codestral: Sending FIM request\");\n\n        let http_request = http_client::Request::builder()\n            .method(http_client::Method::POST)\n            .uri(format!(\"{}/v1/fim/completions\", api_url))\n            .header(\"Content-Type\", \"application/json\")\n            .header(\"Authorization\", format!(\"Bearer {}\", api_key))\n            .body(http_client::AsyncBody::from(request_body))?;\n\n        let mut response = http_client.send(http_request).await?;\n        let status = response.status();\n\n        log::debug!(\"Codestral: Response status: {}\", status);\n\n        if !status.is_success() {\n            let mut body = String::new();\n            response.body_mut().read_to_string(&mut body).await?;\n            return Err(anyhow::anyhow!(\n                \"Codestral API error: {} - {}\",\n                status,\n                body\n            ));\n        }\n\n        let mut body = String::new();\n        response.body_mut().read_to_string(&mut body).await?;\n\n        let codestral_response: CodestralResponse = serde_json::from_str(&body)?;\n\n        let elapsed = start_time.elapsed();\n\n        if let Some(choice) = codestral_response.choices.first() {\n            let completion = &choice.message.content;\n\n            log::debug!(\n                \"Codestral: Completion received ({} tokens, {:.2}s)\",\n                codestral_response.usage.completion_tokens,","sourceCodeStart":147,"sourceCodeEnd":183,"githubUrl":"https://github.com/zed-industries/zed/blob/5a9b9558db01a6b906cec2fb70a797affdc58cdd/crates/codestral/src/codestral.rs#L147-L183","documentation":"Raised in fetch_completion when the Codestral FIM completions endpoint returns a non-success HTTP status. The message includes the status code and response body, so the API itself rejected the request (bad API key, rate limit, or invalid payload).","triggerScenarios":"Thrown at crates/codestral/src/codestral.rs:165 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the included status/body: 401/403 means an invalid or expired API key, 429 means rate limiting","Verify the configured Codestral API URL and key are correct","Back off and retry on rate-limit or transient 5xx responses"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"5a9b9558db01a6b906cec2fb70a797affdc58cdd","analyzedAt":"2026-08-20T19:29:52.058Z","contentChangedAt":"2026-08-20T19:29:52.058Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}