{"record":{"id":"b2c56c9a9391accc","repo":"a-b-street/abstreet","slug":"load","errorCode":null,"errorMessage":"{:?}","messagePattern":"\\{:\\?\\}","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"widgetry/src/tools/load.rs","lineNumber":195,"sourceCode":"                            while let Some(Ok(chunk)) = stream.next().await {\n                                let array = js_sys::Uint8Array::new(&chunk);\n                                if let Err(err) =\n                                    tx_read_bytes.try_send(array.byte_length() as usize)\n                                {\n                                    warn!(\"Couldn't send update on bytes: {}\", err);\n                                }\n                                // TODO Can we avoid this clone?\n                                buffer.extend(array.to_vec());\n                            }\n                            tx.send(Ok(buffer)).unwrap();\n                        } else {\n                            let status = resp.status();\n                            let err = resp.status_text();\n                            tx.send(Err(anyhow!(\"HTTP {}: {}\", status, err))).unwrap();\n                        }\n                    }\n                    Err(err) => {\n                        tx.send(Err(anyhow!(\"{:?}\", err))).unwrap();\n                    }\n                }\n            });\n\n            Box::new(FileLoader {\n                response: rx,\n                on_load: Some(on_load),\n                panel: ctx.make_loading_screen(Text::from(format!(\"Loading {}...\", url))),\n                started: Instant::now(),\n                url,\n                total_bytes: None,\n                read_bytes: 0,\n                got_total_bytes,\n                got_read_bytes,\n            })\n        }\n    }\n","sourceCodeStart":177,"sourceCodeEnd":213,"githubUrl":"https://github.com/a-b-street/abstreet/blob/0964f29315820c91b171b585eb51e300164e9197/widgetry/src/tools/load.rs#L177-L213","documentation":"The same FileLoader also formats raw fetch failures as '{:?}' — the JS error value returned by the fetch promise's Err branch, debug-printed into an anyhow error. This covers network-level failures before an HTTP status exists: DNS failure, connection refused, CORS blocks (browser yields a TypeError), or aborts.","triggerScenarios":"The wasm fetch promise rejects: network is offline, server unreachable, CORS preflight blocked, invalid URL causing a JS TypeError, or the request was aborted.","commonSituations":"Developing against a local server that isn't running, wrong port/hostname, missing CORS headers when the page origin differs from the file host, typo in the URL scheme.","solutions":["Check browser devtools Network/Console tab for the underlying JS error (often 'Failed to fetch' = CORS or server down)","Confirm the server is running and the URL/port is correct","Add CORS headers on the server (Access-Control-Allow-Origin)","Verify the URL is absolute and valid for the browser context"],"exampleFix":"// before: relative path that may not resolve from the page origin\ntx.send(load(\"data/map.bin\"));\n// after: absolute URL on a CORS-enabled server\ntx.send(load(\"http://localhost:8000/data/map.bin\"));","handlingStrategy":"retry","validationCode":"function reachable(url: string): Promise<boolean> {\n  return fetch(url, { method: 'HEAD' }).then(() => true).catch(() => false);\n}","typeGuard":null,"tryCatchPattern":"match file_loader.response.recv() {\n    Ok(Ok(bytes)) => use(bytes),\n    Ok(Err(e)) => retry_with_backoff(3, || load(url)),\n    Err(_) => show_error(\"loader closed\"),\n}","preventionTips":["Confirm the server is up and the URL/port is right before loading","Add CORS headers (Access-Control-Allow-Origin) on the asset host","Check devtools Network tab for 'Failed to fetch' to distinguish CORS from downtime","Use absolute URLs in deployed builds"],"tags":["network","fetch","wasm","cors"],"backgroundTag":"network-request-failed","analyzedSha":"0964f29315820c91b171b585eb51e300164e9197","analyzedAt":"2026-09-13T18:02:03.421Z","contentChangedAt":"2026-09-13T18:02:03.421Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}