zed-industries/zed · error
Request failed with status: {status:?} Body: {body}
Error message
Request failed with status: {status:?}
Body: {body} What it means
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.).
Source
Thrown at crates/edit_prediction/src/edit_prediction.rs:3098
ZedUpdateRequiredError {
minimum_version: minimum_required_version
}
);
}
if response.status().is_success() {
let usage = EditPredictionUsage::from_headers(response.headers()).ok();
let mut body = Vec::new();
response.body_mut().read_to_end(&mut body).await?;
Ok((serde_json::from_slice(&body)?, usage))
} else {
let status = response.status();
let mut body = String::new();
response.body_mut().read_to_string(&mut body).await?;
if status == http_client::http::StatusCode::REQUEST_TIMEOUT {
return Err(anyhow::Error::new(CloudRequestTimeoutError));
}
anyhow::bail!("Request failed with status: {status:?}\nBody: {body}");
}
}
pub fn refresh_context(
&mut self,
project: &Entity<Project>,
buffer: &Entity<language::Buffer>,
cursor_position: language::Anchor,
cx: &mut Context<Self>,
) {
self.get_or_init_project(project, cx)
.context
.update(cx, |store, cx| {
store.refresh(buffer.clone(), cursor_position, cx);
});
}
pub fn collect_editable_context(View on GitHub (pinned to f4178619ac)
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.
Defensive patterns
Strategy: retry
Try / catch
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.
Prevention
- 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.
When it happens
Trigger: 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.
Common situations: Stale credentials after sign-out/re-login; hitting Zeta rate limits during heavy use; Zed service incidents; proxies stripping the Authorization header.
Understand the failure class
Background: "API error: {status}" and "HTTP 401/403/404/429/5xx" errors: non-2xx HTTP responses explained — this error's family across 27 libraries.
Related errors
- Request failed with status: {:?} Body: {}
- Failed to fetch experiments: {:?} Body: {}
- missing Content-Type header
- Failed to connect to DeepSeek API: {} {}
- Feedback API returned status: {}
AI-assisted analysis of zed-industries/zed@f4178619ac (2026-08-20).
Data as JSON: /api/errors/d2054dbaf31ba6c3.
Report an issue: GitHub.