{"record":{"id":"f5e847fabe067e97","repo":"zed-industries/zed","slug":"copilot-did-not-provide-an-output-limit-for-this-model","errorCode":null,"errorMessage":"Copilot did not provide an output limit for this model","messagePattern":"Copilot did not provide an output limit for this model","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/copilot_chat/src/model.rs","lineNumber":178,"sourceCode":"\n            CompletionIntent::Subagent\n            | CompletionIntent::ToolResults\n            | CompletionIntent::ThreadSummarization\n            | CompletionIntent::CreateFile\n            | CompletionIntent::EditFile => false,\n        });\n\n        if self.model.supports_messages() {\n            let location = intent_to_chat_location(request.intent);\n            let model = self.model.clone();\n            let copilot_chat = self.copilot_chat.clone();\n            let request_limiter = self.request_limiter.clone();\n            let future = cx.spawn(async move |cx| {\n                let max_output_tokens = model\n                    .max_output_tokens()\n                    .or(request.max_output_tokens)\n                    .ok_or_else(|| {\n                        anyhow!(\"Copilot did not provide an output limit for this model\")\n                    })?;\n                let effort = request\n                    .thinking_effort\n                    .as_ref()\n                    .and_then(|e| anthropic::Effort::from_str(e).ok());\n\n                let mut anthropic_request = into_anthropic(\n                    request,\n                    model.id().to_string(),\n                    0.0,\n                    max_output_tokens,\n                    if model.supports_adaptive_thinking() {\n                        AnthropicModelMode::Thinking {\n                            budget_tokens: None,\n                        }\n                    } else if model.supports_thinking() {\n                        AnthropicModelMode::Thinking {\n                            budget_tokens: compute_thinking_budget(","sourceCodeStart":160,"sourceCodeEnd":196,"githubUrl":"https://github.com/zed-industries/zed/blob/916fc2b8cb3a815cbef4a3b40e13081be72036b6/crates/copilot_chat/src/model.rs#L160-L196","documentation":"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.","triggerScenarios":"Calling `stream_completion` with a model whose `max_output_tokens()` returns None and a request that does not set `request.max_output_tokens`.","commonSituations":"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.","solutions":["Set `max_output_tokens` explicitly on the CompletionRequest","Update to a version whose Copilot model table includes the model you're using","Pick a model known to the adapter (one that reports its own output limit)","If this is a new upstream model, add its max output tokens to the model metadata in crates/copilot_chat/src/model.rs"],"exampleFix":"// before\nlet request = CompletionRequest { model, messages, ..Default::default() };\n// after\nlet request = CompletionRequest { model, messages, max_output_tokens: Some(8192), ..Default::default() };","handlingStrategy":"validation","validationCode":"if model.max_output_tokens().is_none() && request.max_output_tokens.is_none() {\n    request.max_output_tokens = Some(8192); // or pick another model\n}","typeGuard":"fn has_output_limit(model: &Model, request: &CompletionRequest) -> bool {\n    model.max_output_tokens().is_some() || request.max_output_tokens.is_some()\n}","tryCatchPattern":"match stream_completion(...).await {\n    Err(e) if e.to_string().contains(\"did not provide an output limit\") => {\n        // retry with explicit max_output_tokens\n    },\n    other => other?,\n}","preventionTips":["Always set max_output_tokens on hand-built CompletionRequests","Keep the Copilot extension/adapter updated for new model catalog entries","Prefer models that advertise their own output limits"],"tags":["copilot","configuration","llm"],"backgroundTag":"missing-required-config-field","analyzedSha":"916fc2b8cb3a815cbef4a3b40e13081be72036b6","analyzedAt":"2026-09-19T19:09:50.599Z","contentChangedAt":"2026-09-19T19:09:50.599Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}