{"record":{"id":"d2054dbaf31ba6c3","repo":"zed-industries/zed","slug":"request-failed-with-status-status-body-body","errorCode":null,"errorMessage":"Request failed with status: {status:?}\nBody: {body}","messagePattern":"Request failed with status: (.+?)\nBody: (.+?)","errorType":"http","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/edit_prediction/src/edit_prediction.rs","lineNumber":3098,"sourceCode":"                ZedUpdateRequiredError {\n                    minimum_version: minimum_required_version\n                }\n            );\n        }\n\n        if response.status().is_success() {\n            let usage = EditPredictionUsage::from_headers(response.headers()).ok();\n            let mut body = Vec::new();\n            response.body_mut().read_to_end(&mut body).await?;\n            Ok((serde_json::from_slice(&body)?, usage))\n        } else {\n            let status = response.status();\n            let mut body = String::new();\n            response.body_mut().read_to_string(&mut body).await?;\n            if status == http_client::http::StatusCode::REQUEST_TIMEOUT {\n                return Err(anyhow::Error::new(CloudRequestTimeoutError));\n            }\n            anyhow::bail!(\"Request failed with status: {status:?}\\nBody: {body}\");\n        }\n    }\n\n    pub fn refresh_context(\n        &mut self,\n        project: &Entity<Project>,\n        buffer: &Entity<language::Buffer>,\n        cursor_position: language::Anchor,\n        cx: &mut Context<Self>,\n    ) {\n        self.get_or_init_project(project, cx)\n            .context\n            .update(cx, |store, cx| {\n                store.refresh(buffer.clone(), cursor_position, cx);\n            });\n    }\n\n    pub fn collect_editable_context(","sourceCodeStart":3080,"sourceCodeEnd":3116,"githubUrl":"https://github.com/zed-industries/zed/blob/f4178619acd0d47ea1f76a2025c42962c6d6638c/crates/edit_prediction/src/edit_prediction.rs#L3080-L3116","documentation":"Edit-prediction (Zeta) cloud request handler: any non-2xx response is read to string and bails with `status` and `body`, except HTTP 408 which is converted into the dedicated `CloudRequestTimeoutError` before bailing (edit_prediction.rs:3098). The body carries the server's explanation (auth failure, rate limit, etc.).","triggerScenarios":"POSTing a prediction request that returns 401/403 (signed out or stale token), 429 (rate limited), 5xx (server-side failure); timeouts take the CloudRequestTimeoutError path instead of this message.","commonSituations":"Stale credentials after sign-out/re-login; hitting Zeta rate limits during heavy use; Zed service incidents; proxies stripping the Authorization header.","solutions":["For 401/403, re-authenticate (sign in again) so a fresh token is sent.","For 429, wait for the rate-limit window and retry; reduce prediction request frequency.","For 5xx, retry later — the service is degraded, not misconfigured.","Inspect the Body text for the server's own message before changing config."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"Downcast the error: `if err.downcast_ref::<CloudRequestTimeoutError>().is_some()` retry silently with backoff; for 429 honor Retry-After; for 401/403 stop retrying and prompt re-auth; otherwise surface status+body.","preventionTips":["Refresh auth tokens before prediction bursts rather than at request time.","Debounce prediction requests to stay under rate limits.","Always read the response body on non-2xx — it carries the actionable message."],"tags":["edit-prediction","zeta","http","zed","status-code"],"backgroundTag":"http-error-response","analyzedSha":"f4178619acd0d47ea1f76a2025c42962c6d6638c","analyzedAt":"2026-08-20T19:29:52.058Z","contentChangedAt":"2026-08-20T19:29:52.058Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}