zed-industries/zed · error
fetch threw an error: {error:?}
Error message
fetch threw an error: {error:?} What it means
Guard in the wasm fetch: window.fetch itself threw synchronously — {error:?} is a JS exception before a Promise was returned, most often a network error (offline, CORS-blocked, invalid mixed content) surfaced as a TypeError.
Source
Thrown at crates/gpui_web/src/http_client.rs:149
init.set_body(uint8array.as_ref());
}
let url = parts.uri.to_string();
let request = web_sys::Request::new_with_str_and_init(&url, &init)
.map_err(|error| anyhow!("failed to create fetch Request: {error:?}"))?;
let request_headers = request.headers();
for (name, value) in &parts.headers {
let value_str = value
.to_str()
.map_err(|_| anyhow!("non-ASCII header value for {name}"))?;
request_headers
.set(name.as_str(), value_str)
.map_err(|error| anyhow!("failed to set header {name}: {error:?}"))?;
}
let promise =
global_fetch(&request).map_err(|error| anyhow!("fetch threw an error: {error:?}"))?;
let response_value = wasm_bindgen_futures::JsFuture::from(promise)
.await
.map_err(|error| anyhow!("fetch failed: {error:?}"))?;
let web_response: web_sys::Response = response_value
.dyn_into()
.map_err(|error| anyhow!("fetch result is not a Response: {error:?}"))?;
let status = web_response.status();
let mut builder = http_client::http::Response::builder().status(status);
// `Headers` is a JS iterable yielding `[name, value]` pairs.
// `js_sys::Array::from` calls `Array.from()` which accepts any iterable.
let header_pairs = js_sys::Array::from(&web_response.headers());
for index in 0..header_pairs.length() {
match header_pairs.get(index).dyn_into::<js_sys::Array>() {
Ok(pair) => match (pair.get(0).as_string(), pair.get(1).as_string()) {
(Some(name), Some(value)) => {View on GitHub (pinned to f4178619ac)
Solutions
- Retry with backoff for transient network failures (offline/flaky connections)
- Verify CORS allows the request from this origin
- Check for mixed-content (https page fetching http) and protocol issues
Defensive patterns
Strategy: retry
When it happens
Trigger: Thrown at crates/gpui_web/src/http_client.rs:149 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of zed-industries/zed@f4178619ac (2026-08-20).
Data as JSON: /api/errors/22eba99d534e8358.
Report an issue: GitHub.