{"record":{"id":"3e73d926116f50b2","repo":"zed-industries/zed","slug":"chatgpt-models-request-failed-http-status-bo","errorCode":null,"errorMessage":"ChatGPT models request failed (HTTP {status}): {body}","messagePattern":"ChatGPT models request failed \\(HTTP (.+?)\\): (.+?)","errorType":"http","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/openai_subscribed/src/openai_subscribed.rs","lineNumber":727,"sourceCode":"        .header(\"Accept\", \"application/json\")\n        .header(\n            \"Authorization\",\n            format!(\"Bearer {}\", credentials.access_token),\n        )\n        .extra_headers(&extra_headers)\n        .body(AsyncBody::default())\n        .context(\"failed to build ChatGPT models request\")?;\n    let mut response = http_client\n        .send(request)\n        .await\n        .context(\"failed to request ChatGPT models\")?;\n    let status = response.status();\n    let mut body = String::new();\n    smol::io::AsyncReadExt::read_to_string(response.body_mut(), &mut body)\n        .await\n        .context(\"failed to read ChatGPT models response\")?;\n    if !status.is_success() {\n        return Err(anyhow!(\n            \"ChatGPT models request failed (HTTP {status}): {body}\"\n        ));\n    }\n\n    let mut models = serde_json::from_str::<ModelsResponse>(&body)\n        .context(\"failed to parse ChatGPT models response\")?\n        .models;\n    models.retain(|model| model.visibility == ModelVisibility::List);\n    models.sort_by_key(|model| model.priority);\n    if models.is_empty() {\n        return Err(anyhow!(\n            \"ChatGPT models response did not contain any picker-visible models\"\n        ));\n    }\n    Ok(models.into_iter().map(ChatGptModel::from).collect())\n}\n\nimpl LanguageModel for OpenAiSubscribedLanguageModel {","sourceCodeStart":709,"sourceCodeEnd":745,"githubUrl":"https://github.com/zed-industries/zed/blob/5a9b9558db01a6b906cec2fb70a797affdc58cdd/crates/openai_subscribed/src/openai_subscribed.rs#L709-L745","documentation":"The ChatGPT models endpoint returned a non-2xx HTTP status, so list_models refuses to parse the body. The status code and response body are included in the error; common causes are an expired or invalid access token (401), rate limiting (429), or server-side errors (5xx).","triggerScenarios":"Thrown at crates/openai_subscribed/src/openai_subscribed.rs:695 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the HTTP status: 401/403 means the access token is stale or revoked — sign out and re-authenticate","For 429 rate limits, wait before the next automatic catalog refresh","For 5xx errors, retry later or check the OpenAI status page","For 404, verify the models endpoint URL has not changed"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"5a9b9558db01a6b906cec2fb70a797affdc58cdd","analyzedAt":"2026-08-20T19:29:52.058Z","contentChangedAt":"2026-08-20T19:29:52.058Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}