zed-industries/zed · error
Codestral API error
Error message
Codestral API error: {} - {} What it means
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).
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
Defensive patterns
Strategy: retry
When it happens
Trigger: Thrown at crates/codestral/src/codestral.rs:165 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of zed-industries/zed@5a9b9558db (2026-08-20).
Data as JSON: /api/errors/759c061f936342bb.
Report an issue: GitHub.
Appendix: source
Thrown at crates/codestral/src/codestral.rs:165
log::debug!("Codestral: Sending FIM request");
let http_request = http_client::Request::builder()
.method(http_client::Method::POST)
.uri(format!("{}/v1/fim/completions", api_url))
.header("Content-Type", "application/json")
.header("Authorization", format!("Bearer {}", api_key))
.body(http_client::AsyncBody::from(request_body))?;
let mut response = http_client.send(http_request).await?;
let status = response.status();
log::debug!("Codestral: Response status: {}", status);
if !status.is_success() {
let mut body = String::new();
response.body_mut().read_to_string(&mut body).await?;
return Err(anyhow::anyhow!(
"Codestral API error: {} - {}",
status,
body
));
}
let mut body = String::new();
response.body_mut().read_to_string(&mut body).await?;
let codestral_response: CodestralResponse = serde_json::from_str(&body)?;
let elapsed = start_time.elapsed();
if let Some(choice) = codestral_response.choices.first() {
let completion = &choice.message.content;
log::debug!(
"Codestral: Completion received ({} tokens, {:.2}s)",
codestral_response.usage.completion_tokens,View on GitHub (pinned to 5a9b9558db)