Error message
“Script error.”
Your page’s error handler receives “Script error.”, an empty file name, line 0 and no error object. The real error happened in a script served by another origin, and the browser keeps its details from your page.
Examples run on 19 November 2026 in Chromium 156 with the Sentry browser SDK 9.47.2, 10.78.0 and 11.12.0. Errilo is in private beta.
What the message says
A page served from http://localhost:8001 loads a script from http://127.0.0.1:8002, a different origin (another host or port is enough). The script throws while it runs. In Chromium 156, the page’s error event receives:
| Field | Value |
|---|---|
message | Script error. |
filename | empty |
lineno, colno | 0, 0 |
error | null: no error object, so no stack trace |
The browser’s developer console, on the other hand, shows the full error: Uncaught TypeError: Cannot read properties of undefined (reading 'apiUrl'). Only your page’s code, and so any error tracking SDK running in it, gets the masked version.
Cause: the script belongs to another origin
A page may run a script from another origin but not read it. The browser applies the same rule to the script’s errors: their message, file and position would reveal part of the script, so the page only gets “Script error.”, unless the other origin allows it with CORS.
This typically concerns your own bundles served from a CDN on another domain, and third-party scripts: analytics, chat, payment widgets, tag managers.
Minimal reproduction
// widget.js, served by another origin
function readApiUrl() {
return window.config.apiUrl;
}
readApiUrl();<script>
window.addEventListener('error', (event) => {
console.log(JSON.stringify([event.message, event.filename, event.lineno, event.colno, event.error && event.error.message]));
});
</script>
<script src="http://127.0.0.1:8002/widget.js"></script>The console prints ["Script error.","",0,0,null].
Fixes
Two changes are needed, one on each side:
- The
crossorigin="anonymous"attribute on the<script>tag: the browser fetches the script in CORS mode. - The
Access-Control-Allow-Originheader on the script’s response, with your page’s origin or*. We checked both values.
<script src="http://127.0.0.1:8002/widget.js" crossorigin="anonymous"></script>Access-Control-Allow-Origin: http://localhost:8001The page then receives the real error: Uncaught TypeError: Cannot read properties of undefined (reading 'apiUrl'), with the script’s URL, line 3, column 24 and the error object with its stack trace.
The attribute without the header is worse than nothing: the script is blocked and doesn’t run at all. Chromium logs Access to script at 'http://127.0.0.1:8002/widget.js' from origin 'http://localhost:8001' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. Set the header on the server or CDN first, then add the attribute.
Vite 8.3.8 already writes crossorigin on the script tags of the index.html it builds: only the header remains to set if your assets are on another origin. For a third-party script whose server doesn’t send the header, there is nothing to do on your side: its errors stay masked.
What the Sentry SDK and Errilo do with it
The Sentry browser SDK drops these errors before sending them. Its default list of ignored errors contains /^Script error\.?$/ and /^Javascript error: Script error\.? on line 0$/ in versions 9.47.2, 10.78.0 and 11.12.0. In our test, no event left the page; once the filter integration was removed, the event arrived with “Script error.” as its message and no usable frame. There is nothing to configure, and Errilo, which has no inbound filters on the server, never receives them.
So with the SDK, the cost of this masking isn’t noise: it’s errors you never see. Adding crossorigin and the header to your own scripts on a CDN makes them visible again.
One exception, checked with the three versions: when the cross-origin script throws inside a setTimeout callback, the SDK reports the real error, with its message and stack trace, even without crossorigin. The SDK wraps setTimeout and catches the error itself, before the browser masks it.
// widget-timer.js, served by another origin
setTimeout(function refresh() {
return window.config.apiUrl;
}, 10);Once the errors come through, the frames of a minified script of yours become readable with source maps.