{"record":{"id":"8dbd7ceeb27ab76d","repo":"mrdoob/three.js","slug":"fetch-for-response-url-responded-with-respo","errorCode":null,"errorMessage":"fetch for \"${response.url}\" responded with ${response.status}: ${response.statusText}","messagePattern":"fetch for \"(.+?)\" responded with (.+?): (.+?)","errorType":"http","errorClass":"HttpError","httpStatus":null,"severity":"error","filePath":"src/loaders/FileLoader.js","lineNumber":220,"sourceCode":"\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t}, ( e ) => {\n\n\t\t\t\t\t\t\t\t\tcontroller.error( e );\n\n\t\t\t\t\t\t\t\t} );\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t} );\n\n\t\t\t\t\treturn new Response( stream );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tthrow new HttpError( `fetch for \"${response.url}\" responded with ${response.status}: ${response.statusText}`, response );\n\n\t\t\t\t}\n\n\t\t\t} )\n\t\t\t.then( response => {\n\n\t\t\t\tswitch ( responseType ) {\n\n\t\t\t\t\tcase 'arraybuffer':\n\n\t\t\t\t\t\treturn response.arrayBuffer();\n\n\t\t\t\t\tcase 'blob':\n\n\t\t\t\t\t\treturn response.blob();\n\n\t\t\t\t\tcase 'document':\n","sourceCodeStart":202,"sourceCodeEnd":238,"githubUrl":"https://github.com/mrdoob/three.js/blob/da05705fa31f02710c19772a2aa70c7454807f0c/src/loaders/FileLoader.js#L202-L238","documentation":"Thrown by FileLoader when the underlying fetch resolves with an HTTP status other than 200 (and not the special status 0 used for file:// and data:// protocols). The error is an HttpError carrying the original Response object so callers can inspect status, headers, and body. It signals the remote resource exists at the URL level but the server refused/failed to serve it.","triggerScenarios":"Calling loader.load(url, onLoad, onProgress, onError) or loadAsync(url) where the server returns 404, 403, 401, 500, 502, 503, etc. Also a wrong/mistyped URL, a missing asset path, an expired/signed S3 URL, or a CDN returning an error page. CORS preflight failures sometimes surface here too.","commonSituations":"Deploying with incorrect base/asset paths. Hot-reload pointing at a moved file. Rate-limited or temporarily down CDN. Authenticated endpoint missing credentials/tokens. Behind a reverse proxy returning HTML error pages for missing routes.","solutions":["Open the URL directly in a browser/Postman and confirm it returns 200; check the status code in the message.","Verify the path and base URL are correct (absolute vs relative, leading slash, public/ vs assets/ folder).","For 401/403, set loader.setWithCredentials(true) and/or supply the required Authorization header via request headers.","For 5xx, implement retry with backoff; for 404, fix or remove the missing asset reference.","Handle CORS: ensure the server sends Access-Control-Allow-Origin for cross-origin requests."],"exampleFix":"// before: only success handler, errors are uncaught\nloader.load(url, onLoad);\n\n// after: supply an onError callback (or await loadAsync in try/catch)\nloader.load(url, onLoad, onProgress, (err) => {\n  console.error('Load failed:', err.message); // includes status + url\n});\n// or\ntry { const data = await loader.loadAsync(url); }\ncatch (e) { console.error(e.message, e.response?.status); }","handlingStrategy":"retry","validationCode":"async function assertReachable(url, options = {}) {\n  const res = await fetch(url, { method: 'HEAD', ...options });\n  if (res.status !== 200 && res.status !== 0) {\n    throw new Error(`${url} unreachable: ${res.status}`);\n  }\n  return true;\n}\n\nawait assertReachable(url);","typeGuard":null,"tryCatchPattern":"async function loadWithRetry(loader, url, retries = 3) {\n  for (let attempt = 1; attempt <= retries; attempt++) {\n    try {\n      return await loader.loadAsync(url);\n    } catch (e) {\n      const status = e.response?.status;\n      if (attempt === retries || (status && status < 500)) throw e;\n      await new Promise(r => setTimeout(r, 2 ** attempt * 200));\n    }\n  }\n}","preventionTips":["Always pass an onError callback to loader.load() (or use loadAsync in try/catch).","Verify asset URLs against the deployed base path before shipping.","Configure CORS headers on cross-origin asset servers.","Retry only idempotent 5xx responses, not 4xx client errors."],"tags":["threejs","network","http","loader","fetch","cors"],"backgroundTag":null,"analyzedSha":"da05705fa31f02710c19772a2aa70c7454807f0c","analyzedAt":"2026-08-12T22:51:37.160Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}