{"record":{"id":"22eba99d534e8358","repo":"zed-industries/zed","slug":"fetch-threw-an-error-error","errorCode":null,"errorMessage":"fetch threw an error: {error:?}","messagePattern":"fetch threw an error: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/gpui_web/src/http_client.rs","lineNumber":149,"sourceCode":"        init.set_body(uint8array.as_ref());\n    }\n\n    let url = parts.uri.to_string();\n    let request = web_sys::Request::new_with_str_and_init(&url, &init)\n        .map_err(|error| anyhow!(\"failed to create fetch Request: {error:?}\"))?;\n\n    let request_headers = request.headers();\n    for (name, value) in &parts.headers {\n        let value_str = value\n            .to_str()\n            .map_err(|_| anyhow!(\"non-ASCII header value for {name}\"))?;\n        request_headers\n            .set(name.as_str(), value_str)\n            .map_err(|error| anyhow!(\"failed to set header {name}: {error:?}\"))?;\n    }\n\n    let promise =\n        global_fetch(&request).map_err(|error| anyhow!(\"fetch threw an error: {error:?}\"))?;\n    let response_value = wasm_bindgen_futures::JsFuture::from(promise)\n        .await\n        .map_err(|error| anyhow!(\"fetch failed: {error:?}\"))?;\n\n    let web_response: web_sys::Response = response_value\n        .dyn_into()\n        .map_err(|error| anyhow!(\"fetch result is not a Response: {error:?}\"))?;\n\n    let status = web_response.status();\n    let mut builder = http_client::http::Response::builder().status(status);\n\n    // `Headers` is a JS iterable yielding `[name, value]` pairs.\n    // `js_sys::Array::from` calls `Array.from()` which accepts any iterable.\n    let header_pairs = js_sys::Array::from(&web_response.headers());\n    for index in 0..header_pairs.length() {\n        match header_pairs.get(index).dyn_into::<js_sys::Array>() {\n            Ok(pair) => match (pair.get(0).as_string(), pair.get(1).as_string()) {\n                (Some(name), Some(value)) => {","sourceCodeStart":131,"sourceCodeEnd":167,"githubUrl":"https://github.com/zed-industries/zed/blob/f4178619acd0d47ea1f76a2025c42962c6d6638c/crates/gpui_web/src/http_client.rs#L131-L167","documentation":"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.","triggerScenarios":"Thrown at crates/gpui_web/src/http_client.rs:149 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","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"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}