dotnet/runtime · error · Error

Failed to load resource '${asset.name}' from '${asset.resolv

Error message

Failed to load resource '${asset.name}' from '${asset.resolvedUrl}': ${message}

What it means

fetchBytes (loader/assets.ts) wraps loadResource(asset) in try/catch. If the underlying fetch/throttle/retry promise rejects (network error, DNS, CORS, abort), it is re-thrown with the asset name, resolvedUrl, and original message as cause. This covers byte resources: assemblies, PDBs, ICU, vfs files.

Source

Thrown at src/native/libs/Common/JavaScript/loader/assets.ts:356

        }
        assetInternal.behavior = "symbols";
        assetInternal.isOptional = assetInternal.isOptional || loaderConfig.ignorePdbLoadErrors;
        tableText = await fetchText(assetInternal);
    } finally {
        onDownloadedAsset(assetInternal);
    }
    dotnetDiagnosticsExports.installNativeSymbols(tableText || "");
}

async function fetchBytes(asset: AssetEntryInternal): Promise<Uint8Array | null> {
    dotnetAssert.check(asset && asset.resolvedUrl, "Bad asset.resolvedUrl");
    let response: Response;
    try {
        response = await loadResource(asset);
    } catch (err: any) {
        // Strip .silent flag from download errors so they are properly reported via exit listeners
        const message = err instanceof Error ? err.message : String(err);
        throw new Error(`Failed to load resource '${asset.name}' from '${asset.resolvedUrl}': ${message}`, { cause: err });
    }
    if (!response.ok) {
        if (asset.isOptional) {
            dotnetLogger.warn(`Optional resource '${asset.name}' failed to load from '${asset.resolvedUrl}'. HTTP status: ${response.status} ${response.statusText}`);
            return null;
        }
        throw new Error(`Failed to load resource '${asset.name}' from '${asset.resolvedUrl}'. HTTP status: ${response.status} ${response.statusText}`);
    }
    const buffer = await (asset.buffer || response.arrayBuffer());
    return new Uint8Array(buffer);
}

async function fetchText(asset: AssetEntryInternal): Promise<string | null> {
    dotnetAssert.check(asset && asset.resolvedUrl, "Bad asset.resolvedUrl");
    let response: Response;
    try {
        response = await loadResource(asset);
    } catch (err: any) {

View on GitHub (pinned to 290d5ab72c)

Solutions

  1. Open resolvedUrl in a browser / curl -v to see the underlying network error.
  2. Fix CORS: serve assets with Access-Control-Allow-Origin matching the page origin, and ensure no-cache mode is permitted.
  3. If hash changed after redeploy, clear browser cache and republish so integrity hashes in the boot config match the files.
  4. Set loaderConfig.disableIntegrityCheck = true only temporarily to isolate SRI mismatch, then fix the root cause.

Example fix

// before: assets on different origin, no CORS headers
app.UseStaticFiles(); // serves from https://cdn.example.com without CORS

// after: enable CORS for the wasm assets
app.UseCors(b => b.WithOrigins("https://app.example.com")
               .WithMethods("GET").AllowCredentials());
Defensive patterns

Strategy: retry

Validate before calling

// Pre-flight: probe the asset URL is reachable
const ok = await fetch(asset.resolvedUrl, { method: 'HEAD' }).then(r => r.ok).catch(() => false);
if (!ok) console.warn('Asset unreachable before load:', asset.resolvedUrl);

Try / catch

try {
  await runtime.fetchAsset(asset);
} catch (err) {
  if (/Failed to load resource/.test(err.message) && err.cause) {
    // inspect err.cause for CORS/DNS/SRI; retry with backoff or report
  } else throw err;
}

Prevention

When it happens

Trigger: A fetch() for a binary asset threw — network down, DNS failure, CORS rejection, integrity mismatch (SRI), TLS error, or an explicit AbortController abort. The error originates before any HTTP status is available.

Common situations: Misconfigured CORS headers on the server; integrity hash mismatch after redeploying changed files; offline/loss of connectivity during load; self-hosted assets served from a different origin without CORS; certificate/TLS issues.

Related errors


AI-assisted analysis of dotnet/runtime@290d5ab72c (2026-08-06). Data as JSON: /api/errors/5a98b6186140799a. Report an issue: GitHub.