zed-industries/zed · error

Response contained no choices

Error message

Response contained no choices

What it means

While mapping Copilot Chat streaming events to language-model completion events, a chunk arrived whose choices list was empty; the parser requires at least one choice per event and treats an empty list as a malformed response.

Source

Thrown at crates/copilot_chat/src/model.rs:346

        tool_calls_by_index: HashMap<usize, RawToolCall>,
        reasoning_opaque: Option<String>,
        reasoning_text: Option<String>,
    }

    futures::stream::unfold(
        State {
            events,
            tool_calls_by_index: HashMap::default(),
            reasoning_opaque: None,
            reasoning_text: None,
        },
        move |mut state| async move {
            if let Some(event) = state.events.next().await {
                match event {
                    Ok(event) => {
                        let Some(choice) = event.choices.first() else {
                            return Some((
                                vec![Err(anyhow!("Response contained no choices").into())],
                                state,
                            ));
                        };

                        let delta = if is_streaming {
                            choice.delta.as_ref()
                        } else {
                            choice.message.as_ref()
                        };

                        let Some(delta) = delta else {
                            return Some((
                                vec![Err(anyhow!("Response contained no delta").into())],
                                state,
                            ));
                        };

                        let mut events = Vec::new();

View on GitHub (pinned to f4178619ac)

Solutions

  1. Treat as a transient protocol quirk and retry the completion
  2. Update Zed if the Copilot Chat event format changed
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/copilot_chat/src/model.rs:346 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of zed-industries/zed@f4178619ac (2026-08-20). Data as JSON: /api/errors/bc7fc7da4033a90f. Report an issue: GitHub.