dotnet/AspNetCore.Docs · error · Error
response.statusText
Error message
response.statusText
What it means
JavaScript Error thrown inside loadBootResource when the Brotli-compressed (.br) resource fetch fails (response.ok is false). The custom boot-resource loader fetches defaultUri + '.br' with cache:'no-cache' for non-localhost, non-js/config/manifest resources and throws response.statusText if the fetch returns a non-OK HTTP status. Applies to ASP.NET Core 8.0+ (the >= aspnetcore-8.0 moniker).
Source
Thrown at aspnetcore/blazor/host-and-deploy/webassembly/index.md:146
:::moniker range=">= aspnetcore-8.0 < aspnetcore-11.0"
Blazor Web App:
:::moniker-end
:::moniker range=">= aspnetcore-8.0"
```html
<script type="module">
import { BrotliDecode } from './decode.min.js';
Blazor.start({
webAssembly: {
loadBootResource: function (type, name, defaultUri, integrity) {
if (type !== 'dotnetjs' && location.hostname !== 'localhost' && type !== 'configuration' && type !== 'manifest') {
return (async function () {
const response = await fetch(defaultUri + '.br', { cache: 'no-cache' });
if (!response.ok) {
throw new Error(response.statusText);
}
const originalResponseBuffer = await response.arrayBuffer();
const originalResponseArray = new Int8Array(originalResponseBuffer);
const decompressedResponseArray = BrotliDecode(originalResponseArray);
const contentType = type ===
'dotnetwasm' ? 'application/wasm' : 'application/octet-stream';
return new Response(decompressedResponseArray,
{ headers: { 'content-type': contentType } });
})();
}
}
}
});
</script>
```
:::moniker-end
View on GitHub (pinned to c67a80103a)
Solutions
- Verify the published wwwroot/_framework contains .br files for each boot resource.
- Configure the static-file middleware / web server to serve precompressed Brotli assets with correct Content-Encoding.
- If hosting without precompression, remove or simplify loadBootResource so it does not append '.br'.
- Check the failing resource's URL and statusText in the browser devtools Network tab to identify 404/403/etc.
- Ensure the CDN/proxy serves the same files for the .br suffix and does not require auth.
Example fix
// before
const response = await fetch(defaultUri + '.br', { cache: 'no-cache' });
if (!response.ok) {
throw new Error(response.statusText);
}
// after — fall back to uncompressed on failure
let response = await fetch(defaultUri + '.br', { cache: 'no-cache' });
if (!response.ok) {
console.warn(`Brotli fetch failed (${response.status}) for ${defaultUri}; falling back.`);
response = await fetch(defaultUri, { cache: 'no-cache' });
if (!response.ok) {
throw new Error(`Boot resource ${defaultUri} failed: ${response.statusText}`);
}
return response;
} Defensive patterns
Strategy: fallback
Validate before calling
// Validate .br availability before relying on it
const probe = await fetch(defaultUri + '.br', { method: 'HEAD' });
if (!probe.ok) { /* skip compression path */ } Type guard
function canServeBrotli() {
return 'DecompressionStream' in window || typeof BrotliDecode === 'function';
} Try / catch
try {
const response = await fetch(defaultUri + '.br', { cache: 'no-cache' });
if (!response.ok) throw new Error(response.statusText);
// decompress...
} catch (err) {
console.warn('Brotli load failed, falling back:', err);
return fetch(defaultUri, { cache: 'no-cache' });
} Prevention
- Publish with precompressed Brotli assets enabled.
- Serve .br files with correct Content-Encoding on the host/CDN.
- Implement a fallback to the uncompressed resource on failure.
- Inspect failing boot-resource requests in devtools Network tab.
When it happens
Trigger: Hosting environment does not serve .br files (compression not enabled or files not published), CDN returns a 404/403 for the .br variant, MIME type misconfiguration causing 404, deployment missing the compressed assets, or a network/CDN transient error returning non-2xx.
Common situations: Publishing without Brotli compression enabled; reverse proxy stripping or not serving precompressed files; CDN cache miss for the .br variant; deployment that omitted wwwroot/_framework compressed files; CORS/auth on the static file endpoint returning 401/403.
Related errors
- ko.mapping.updateFromJS, use ko.mapping.fromJS instead. Plea
- ko.mapping.updateFromJSON, use ko.mapping.fromJSON instead.
- Must provide a non-empty value for the "src" attribute.
AI-assisted analysis of dotnet/AspNetCore.Docs@c67a80103a (2026-08-13).
Data as JSON: /api/errors/eba34f0599db6e9b.
Report an issue: GitHub.