zed-industries/zed · error

Copilot did not provide an output limit for this model

Error message

Copilot did not provide an output limit for this model

What it means

Copilot Chat cannot start a completion stream because it could not determine a maximum output token limit. The adapter requires either the model's own advertised output limit or an explicit `max_output_tokens` on the request; without one it refuses to build the request limiter.

Solutions

  1. Set `max_output_tokens` explicitly on the CompletionRequest
  2. Update to a version whose Copilot model table includes the model you're using
  3. Pick a model known to the adapter (one that reports its own output limit)
  4. If this is a new upstream model, add its max output tokens to the model metadata in crates/copilot_chat/src/model.rs

Example fix

// before
let request = CompletionRequest { model, messages, ..Default::default() };
// after
let request = CompletionRequest { model, messages, max_output_tokens: Some(8192), ..Default::default() };
Defensive patterns

Strategy: validation

Validate before calling

if model.max_output_tokens().is_none() && request.max_output_tokens.is_none() {
    request.max_output_tokens = Some(8192); // or pick another model
}

Type guard

fn has_output_limit(model: &Model, request: &CompletionRequest) -> bool {
    model.max_output_tokens().is_some() || request.max_output_tokens.is_some()
}

Try / catch

match stream_completion(...).await {
    Err(e) if e.to_string().contains("did not provide an output limit") => {
        // retry with explicit max_output_tokens
    },
    other => other?,
}

Prevention

When it happens

Trigger: Calling `stream_completion` with a model whose `max_output_tokens()` returns None and a request that does not set `request.max_output_tokens`.

Common situations: Using a newly added or unknown Copilot model that isn't in the adapter's model table, or a client constructing a raw CompletionRequest without token limits after a Copilot model catalog change.

Understand the failure class

Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.

Related errors


AI-assisted analysis of zed-industries/zed@916fc2b8cb (2026-09-19). Data as JSON: /api/errors/f5e847fabe067e97. Report an issue: GitHub.

Appendix: source

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

            CompletionIntent::Subagent
            | CompletionIntent::ToolResults
            | CompletionIntent::ThreadSummarization
            | CompletionIntent::CreateFile
            | CompletionIntent::EditFile => false,
        });

        if self.model.supports_messages() {
            let location = intent_to_chat_location(request.intent);
            let model = self.model.clone();
            let copilot_chat = self.copilot_chat.clone();
            let request_limiter = self.request_limiter.clone();
            let future = cx.spawn(async move |cx| {
                let max_output_tokens = model
                    .max_output_tokens()
                    .or(request.max_output_tokens)
                    .ok_or_else(|| {
                        anyhow!("Copilot did not provide an output limit for this model")
                    })?;
                let effort = request
                    .thinking_effort
                    .as_ref()
                    .and_then(|e| anthropic::Effort::from_str(e).ok());

                let mut anthropic_request = into_anthropic(
                    request,
                    model.id().to_string(),
                    0.0,
                    max_output_tokens,
                    if model.supports_adaptive_thinking() {
                        AnthropicModelMode::Thinking {
                            budget_tokens: None,
                        }
                    } else if model.supports_thinking() {
                        AnthropicModelMode::Thinking {
                            budget_tokens: compute_thinking_budget(

View on GitHub (pinned to 916fc2b8cb)