zed-industries/zed · error
No completion returned from Codestral
Error message
No completion returned from Codestral
What it means
Returned by fetch_completion when the Codestral API responded successfully but the parsed response contained no choices. The API accepted the request yet produced an empty completion list, so there is no text to insert at the cursor.
Solutions
- Treat as an empty completion and skip inserting any edit prediction
- Retry the request; occasional empty responses can be transient
- If persistent, verify the prompt/format sent to the FIM endpoint is valid
Defensive patterns
Strategy: fallback
When it happens
Trigger: Thrown at crates/codestral/src/codestral.rs:192 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/5ce497accf86f95a.
Report an issue: GitHub.
Appendix: source
Thrown at crates/codestral/src/codestral.rs:192
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,
elapsed.as_secs_f64()
);
// Return just the completion text for insertion at cursor
Ok(completion.clone())
} else {
log::error!("Codestral: No completion returned in response");
Err(anyhow::anyhow!("No completion returned from Codestral"))
}
}
}
impl EditPredictionDelegate for CodestralEditPredictionDelegate {
fn name() -> &'static str {
"codestral"
}
fn display_name() -> &'static str {
"Codestral"
}
fn show_predictions_in_menu() -> bool {
true
}
fn icons(&self, _cx: &App) -> EditPredictionIconSet {
EditPredictionIconSet::new(IconName::AiMistral)View on GitHub (pinned to 5a9b9558db)