{"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":1034,"sourceCode":"        .data\n        .context(\"GraphQL response contained no data field\")?;\n\n    Ok(data.viewer.copilot_endpoints.api)\n}\n\npub(crate) fn copilot_request_headers(\n    builder: http_client::Builder,\n    oauth_token: &str,\n    is_user_initiated: Option<bool>,\n    location: Option<ChatLocation>,\n) -> http_client::Builder {\n    builder\n        .header(\"Authorization\", format!(\"Bearer {}\", oauth_token))\n        .header(\"Content-Type\", \"application/json\")\n        .header(\n            \"Editor-Version\",\n            format!(\n                \"Zed/{}\",\n                option_env!(\"CARGO_PKG_VERSION\").unwrap_or(\"unknown\")\n            ),\n        )\n        .header(\"X-GitHub-Api-Version\", \"2025-10-01\")\n        .when_some(is_user_initiated, |builder, is_user_initiated| {\n            builder.header(\n                \"X-Initiator\",\n                if is_user_initiated { \"user\" } else { \"agent\" },\n            )\n        })\n        .when_some(location, |builder, loc| {\n            let interaction_type = loc.to_intent_string();\n            builder\n                .header(\"X-Interaction-Type\", interaction_type)\n                .header(\"OpenAI-Intent\", interaction_type)\n        })\n}\n","sourceCodeStart":1016,"sourceCodeEnd":1052,"githubUrl":"https://github.com/zed-industries/zed/blob/916fc2b8cb3a815cbef4a3b40e13081be72036b6/crates/copilot_chat/src/copilot_chat.rs#L1016-L1052","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":"916fc2b8cb3a815cbef4a3b40e13081be72036b6","analyzedAt":"2026-08-20T19:29:52.058Z","contentChangedAt":"2026-08-20T19:29:52.058Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}