{"record":{"id":"8c123e22a47723aa","repo":"zed-industries/zed","slug":"failed-to-request-models","errorCode":null,"errorMessage":"Failed to request models: {}","messagePattern":"Failed to request models: (.+?)","errorType":"http","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/copilot_chat/src/copilot_chat.rs","lineNumber":1026,"sourceCode":"async fn request_models(\n    models_url: Arc<str>,\n    oauth_token: String,\n    client: Arc<dyn HttpClient>,\n) -> Result<Vec<Model>> {\n    let request_builder = copilot_request_headers(\n        HttpRequest::builder()\n            .method(Method::GET)\n            .uri(models_url.as_ref()),\n        &oauth_token,\n        None,\n        None,\n    );\n\n    let request = request_builder.body(AsyncBody::empty())?;\n\n    let mut response = client.send(request).await?;\n\n    anyhow::ensure!(\n        response.status().is_success(),\n        \"Failed to request models: {}\",\n        response.status()\n    );\n    let mut body = Vec::new();\n    response.body_mut().read_to_end(&mut body).await?;\n\n    let body_str = std::str::from_utf8(&body)?;\n\n    let models = serde_json::from_str::<ModelSchema>(body_str)?.data;\n\n    Ok(models)\n}\n\nasync fn stream_completion(\n    client: Arc<dyn HttpClient>,\n    oauth_token: String,\n    completion_url: Arc<str>,","sourceCodeStart":1008,"sourceCodeEnd":1044,"githubUrl":"https://github.com/zed-industries/zed/blob/f4178619acd0d47ea1f76a2025c42962c6d6638c/crates/copilot_chat/src/copilot_chat.rs#L1008-L1044","documentation":"In request_models for Copilot Chat: anyhow::ensure! fires when the HTTP response from the Copilot models endpoint has a non-success status. It surfaces the status code so callers know the provider rejected the models listing request (auth expiry, server error, rate limit).","triggerScenarios":"Thrown at crates/copilot_chat/src/copilot_chat.rs:1026 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the status: 401/403 means the OAuth token expired — re-sign-in; 5xx is a Copilot service issue","Retry the request after re-authentication or service recovery"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"f4178619acd0d47ea1f76a2025c42962c6d6638c","analyzedAt":"2026-08-20T19:29:52.058Z","contentChangedAt":"2026-08-20T19:29:52.058Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}