{"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/290d5ab72cc1102813fbc0406fb186ceadabc340/src/native/libs/Common/JavaScript/loader/assets.ts#L345-L381","documentation":"fetchBytes: loadResource returned a Response with response.ok === false and the asset is not marked isOptional. The HTTP status and statusText are surfaced. This is the non-optional HTTP-error path — optional assets only warn.","triggerScenarios":"Server returned 4xx/5xx for a required binary asset (assembly, pdb, icu, vfs). E.g. 404 because the file is missing from the deploy, 401/403 due to auth, 500 from a misconfigured server.","commonSituations":"File missing from publish output (404); auth-protected static files (401/403); reverse proxy or CDN misroute (502/504); wrong applicationBase path resolving the URL; file deleted from the server after boot config was generated.","solutions":["GET the resolvedUrl directly and read the exact HTTP status to diagnose (404 → missing file, 403 → auth).","Ensure the published wwwroot/_framework contains every assembly/pdb/icu listed in the boot config.","Fix the applicationBase / virtualWorkingDirectory if URLs resolve to the wrong path.","For auth-protected deployments, allow anonymous GET on static framework files or use a loadBootResource callback that adds credentials."],"exampleFix":"// before: framework files behind auth middleware\napp.UseAuthentication();\napp.UseAuthorization();\napp.UseStaticFiles(); // 401 for /_framework/*.dll\n\n// after: allow anonymous on framework assets\napp.UseStaticFiles(new StaticFileOptions {\n  FileProvider = new PhysicalFileProvider(Path.Combine(env.WebRootPath, \"_framework\")),\n  RequestPath = \"/_framework\",\n  OnPrepareResponse = ctx => ctx.Context.Response.Headers.Append(\"Cache-Control\", \"public\")\n});","handlingStrategy":"validation","validationCode":"async function assetReachable(url: string): Promise<boolean> {\n  const r = await fetch(url, { method: 'HEAD' });\n  return r.ok;\n}\nif (!await assetReachable(asset.resolvedUrl)) {\n  throw new Error(`Server returned non-200 for ${asset.resolvedUrl} — check deployment`);\n}","typeGuard":null,"tryCatchPattern":"try { await runtime.fetchAsset(asset); }\ncatch (err) {\n  const m = err.message.match(/HTTP status: (\\d+)/);\n  if (m) {\n    const status = +m[1];\n    if (status === 404) reportMissingFile(asset);\n    else if (status === 401 || status === 403) reportAuthIssue(asset);\n  }\n  throw err;\n}","preventionTips":["Deploy the full _framework folder; never partially publish.","Allow anonymous GET on framework assets.","Add a smoke test that HEADs every asset listed in blazor.boot.json."],"tags":["network","http","assets","server","deployment"],"analyzedSha":"290d5ab72cc1102813fbc0406fb186ceadabc340","analyzedAt":"2026-08-06T19:57:01.276Z","schemaVersion":2},"datasetVersion":"2026-08-06T23:17:07.152Z"}