{"record":{"id":"2f586be136b15e4c","repo":"dotnet/runtime","slug":"failed-to-load-resource-asset-name-from-as-2f586b","errorCode":null,"errorMessage":"Failed to load resource '${asset.name}' from '${asset.resolvedUrl}'. HTTP status: ${response.status} ${response.statusText}","messagePattern":"Failed to load resource '(.+?)' from '(.+?)'\\. HTTP status: (.+?) (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/native/libs/Common/JavaScript/loader/assets.ts","lineNumber":363,"sourceCode":"    dotnetDiagnosticsExports.installNativeSymbols(tableText || \"\");\n}\n\nasync function fetchBytes(asset: AssetEntryInternal): Promise<Uint8Array | null> {\n    dotnetAssert.check(asset && asset.resolvedUrl, \"Bad asset.resolvedUrl\");\n    let response: Response;\n    try {\n        response = await loadResource(asset);\n    } catch (err: any) {\n        // Strip .silent flag from download errors so they are properly reported via exit listeners\n        const message = err instanceof Error ? err.message : String(err);\n        throw new Error(`Failed to load resource '${asset.name}' from '${asset.resolvedUrl}': ${message}`, { cause: err });\n    }\n    if (!response.ok) {\n        if (asset.isOptional) {\n            dotnetLogger.warn(`Optional resource '${asset.name}' failed to load from '${asset.resolvedUrl}'. HTTP status: ${response.status} ${response.statusText}`);\n            return null;\n        }\n        throw new Error(`Failed to load resource '${asset.name}' from '${asset.resolvedUrl}'. HTTP status: ${response.status} ${response.statusText}`);\n    }\n    const buffer = await (asset.buffer || response.arrayBuffer());\n    return new Uint8Array(buffer);\n}\n\nasync function fetchText(asset: AssetEntryInternal): Promise<string | null> {\n    dotnetAssert.check(asset && asset.resolvedUrl, \"Bad asset.resolvedUrl\");\n    let response: Response;\n    try {\n        response = await loadResource(asset);\n    } catch (err: any) {\n        // Strip .silent flag from download errors so they are properly reported via exit listeners\n        const message = err instanceof Error ? err.message : String(err);\n        throw new Error(`Failed to load resource '${asset.name}' from '${asset.resolvedUrl}': ${message}`, { cause: err });\n    }\n    if (!response.ok) {\n        if (asset.isOptional) {\n            dotnetLogger.warn(`Optional resource '${asset.name}' failed to load from '${asset.resolvedUrl}'. HTTP status: ${response.status} ${response.statusText}`);","sourceCodeStart":345,"sourceCodeEnd":381,"githubUrl":"https://github.com/dotnet/runtime/blob/60108ba66eb7d1d12f595480091b4ad80a24b172/src/native/libs/Common/JavaScript/loader/assets.ts#L345-L381","documentation":"Thrown by fetchBytes() when the HTTP response was obtained but response.ok is false AND the asset is not marked optional. This is a real server reply with an error status (4xx/5xx). The status code and statusText tell you exactly what the server returned. Contrast with 101 which fires when no response is obtained at all.","triggerScenarios":"HTTP 404 because the asset was not published to wwwroot/_framework. HTTP 401/403 from authenticated endpoints. HTTP 500 from a misconfigured server. asset.isOptional is unset (default) so any non-2xx aborts startup. Server returns 200 with wrong content but wrong status set by a custom callback.","commonSituations":"Publishing the app but forgetting 'dotnet publish' so _framework is stale/missing assemblies. Renaming a DLL and not republishing. CDN cache serving a stale 404. IIS missing MIME map for .wasm/.dll (would actually 404 the file). Authentication cookie expired so the static file endpoint returns 401. web.config rewrite rules swallowing the file path.","solutions":["Run dotnet publish again and confirm the file exists under bin/Release/net*/publish/wwwroot/_framework/.","Match the exact filename (case, extension) the boot manifest references against what is deployed.","Add anonymous static-file auth for /_framework or pass credentials via asset.useCredentials=true.","Fix server MIME types (application/wasm for .wasm) and rewrite rules so the file is served.","If the asset is genuinely optional (e.g. satellite PDB), mark isOptional=true or set loaderConfig.ignorePdbLoadErrors=true."],"exampleFix":"// before: 404 because satellite .dll not published\n// after: ensure publish includes all satellites\ndotnet publish -c Release --self-contained\n// or mark optional\nloaderConfig.ignorePdbLoadErrors = true;","handlingStrategy":"validation","validationCode":"async function assetExists(url: string): Promise<boolean> {\n  const r = await fetch(url, { method: 'HEAD' });\n  return r.ok;\n}\n// before create():\nfor (const a of loaderConfig.resources!.assembly) {\n  if (!await assetExists(a.resolvedUrl!)) console.warn('Missing', a.name);\n}","typeGuard":"function hasOkStatus(r: Response): boolean { return r.ok; }","tryCatchPattern":"try { await dotnet.create(); } catch (e) {\n  const m = (e as Error).message.match(/HTTP status: (\\d{3})/);\n  if (m) handleHttpError(Number(m[1]));\n  else throw e;\n}","preventionTips":["Run dotnet publish and verify every file in _framework is uploaded to the server.","Add a CI step that curls each asset URL from the boot manifest and asserts 200.","Mark genuinely optional assets isOptional=true so a 4xx does not abort startup.","Configure server MIME types for .wasm (application/wasm) and .dll."],"tags":["network","http-status","publish","deployment"],"backgroundTag":null,"analyzedSha":"60108ba66eb7d1d12f595480091b4ad80a24b172","analyzedAt":"2026-08-10T18:54:11.478Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}