discourse/discourse · error · Error
Download failed
Error message
Download failed: ${response.status} What it means
downloadBlob fetched the URL with same-origin credentials and got a non-ok HTTP response; instead of a blob, it throws with the numeric status. Callers like theme export and download flows use this to surface server-side failures (auth, not-found, server errors) rather than getting an empty or error-page file.
Solutions
- Check the status code: 401/403 means authentication or permission issues, 404 means the URL is wrong, 5xx is a server error
- Verify the user is logged in and authorized for the resource
- Retry the request if the status indicates a transient server error
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at frontend/discourse/app/lib/download-blob.js:54 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of discourse/discourse@1b2d7253e8 (2026-08-26).
Data as JSON: /api/errors/0185046c2fe4cb78.
Report an issue: GitHub.
Appendix: source
Thrown at frontend/discourse/app/lib/download-blob.js:54
}
a.rel = "noopener";
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
setTimeout(() => URL.revokeObjectURL(objectUrl), REVOKE_AFTER);
}
// Fetches `url` and triggers a browser download of the response body.
export default async function downloadBlob(
url,
{ fallbackFilename, fetchOptions } = {}
) {
const response = await fetch(url, {
credentials: "same-origin",
...fetchOptions,
});
if (!response.ok) {
throw new Error(`Download failed: ${response.status}`);
}
triggerBlobDownload(await response.blob(), {
fallbackFilename,
contentDisposition: response.headers.get("Content-Disposition"),
});
}
View on GitHub (pinned to 1b2d7253e8)