{"record":{"id":"a321b34ebda1eef3","repo":"zed-industries/zed","slug":"fetch-result-is-not-a-response-error","errorCode":null,"errorMessage":"fetch result is not a Response: {error:?}","messagePattern":"fetch result is not a Response: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/gpui_web/src/http_client.rs","lineNumber":156,"sourceCode":"    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)) => {\n                    builder = builder.header(name, value);\n                }\n                (name, value) => {\n                    log::warn!(\n                        \"skipping response header at index {index}: \\\n                                     name={name:?}, value={value:?}\"\n                    );","sourceCodeStart":138,"sourceCodeEnd":174,"githubUrl":"https://github.com/zed-industries/zed/blob/f4178619acd0d47ea1f76a2025c42962c6d6638c/crates/gpui_web/src/http_client.rs#L138-L174","documentation":"Guard in the wasm fetch: the fetch Promise resolved to a value that dyn_into failed to cast into a web_sys::Response — {error:?} is the wasm-bindgen conversion error. The browser returned something other than a Response object, which should not normally happen and indicates an environment/interop anomaly.","triggerScenarios":"Thrown at crates/gpui_web/src/http_client.rs:156 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Log the actual JS type (JS::typeof / constructor name) to diagnose the environment","Ensure fetch is not shimmed/monkey-patched by other scripts returning non-Response values","Fail the request future with a descriptive error rather than attempting to continue"],"exampleFix":null,"handlingStrategy":"try-catch","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-14T05:17:10.506Z"}