---
title: "\"Script error.\" with no stack: get the real error from a cross-origin script | Proofline"
description: "A Script error. with no file or stack means a cross-origin script loaded without CORS threw, and the browser hid the details."
url: https://proofline.sh/learn/script-error-no-details/
---

[Learning center](/learn/)

# "Script error." with no stack: get the real error from a cross-origin script

A Script error. with no file or stack means a cross-origin script loaded without CORS threw, and the browser hid the details. Serve the script with CORS and load it with crossorigin to see the real error.

Broken dependencies The Proofline team November 20, 2026 4 min read

## Why the details are hidden

A page can load a script from any origin. If the browser passed that script's error messages to the page, a page could probe scripts from other sites and learn private information from their errors. The HTML standard therefore gives a classic script fetched without CORS _muted errors_: error events from it carry no message, file or position. [HTML standard: muted errors](https://html.spec.whatwg.org/multipage/webappapis.html#muted-errors) · [MDN: `crossorigin` on scripts](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/script#crossorigin)

## Reproduced in Chromium

A page on `http://localhost:8101` loaded the same failing script twice from `http://127.0.0.1:8102`: once with a plain `<script src>`, once with `crossorigin="anonymous"` while the server sent `Access-Control-Allow-Origin: http://localhost:8101`. The page logged each `error` event.

```
plain <script>:
  message="Script error."  filename=""  lineno=0  error=null

crossorigin + Access-Control-Allow-Origin:
  message="Uncaught TypeError: Cannot read properties of undefined (reading 'length')"
  filename="http://127.0.0.1:8102/widget.js?cors=1"  lineno=1
  error=TypeError: Cannot read properties of undefined (reading 'length')
```

The DevTools Console showed the full `TypeError` in both cases. DevTools is not subject to muting; only the page's own error handlers are. That difference is the quickest way to recover the message for one user: reproduce with DevTools open and copy the Console text.

## Two causes behind `Script error.`

|  | Cause A: your own script, served from another origin | Cause B: a third-party script you do not control |
| --- | --- | --- |
| Examples | Your bundle on a CDN or static host such as `static.example.test` | A chat widget, analytics tag or payment script |
| Fix | Send `Access-Control-Allow-Origin` from the asset host and add `crossorigin="anonymous"` to the tag | Ask the vendor; you can only add `crossorigin` if their server sends CORS headers |
| What to report | The asset host and the missing header | The vendor, the script URL and the Console text from a reproduction |

The deciding observation is the script's origin. Find every `<script src>` whose origin differs from the page's, and check each one's response headers in the Network panel for `Access-Control-Allow-Origin`. The script whose error you are chasing is usually the one that loads just before the time of the error, or the one named in the Console's stack in a reproduction.

## Add `crossorigin` only with the header

Adding `crossorigin="anonymous"` to a script tag changes how the browser fetches it: the request uses CORS. If the server does not answer with an `Access-Control-Allow-Origin` that matches the page, the browser refuses to run the script. Turn on the header first, check it in the Network panel, then add the attribute. [MDN: CORS settings attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Attributes/crossorigin)

Module scripts, loaded with `type="module"`, always use CORS for cross-origin fetches, so their errors are not muted.

## Worked example: an error spike nobody can read

This example is fictional. An error tracker shows 3,000 `Script error.` events a day from the checkout page, with no stack. The team cannot tell whether checkout is broken.

The checkout page loaded three cross-origin scripts: the app bundle from `static.shop.test`, a payment script and a chat widget. Only the bundle's host was the team's own. Its responses had no `Access-Control-Allow-Origin`. After the asset host sent the header and the tag gained `crossorigin="anonymous"`, the same events arrived as `TypeError: Cannot read properties of null (reading 'addEventListener')` from `checkout-7d1e.js`, line 1, which the [source map guide](/learn/minified-stack-trace/) then mapped to a missing element check.

The report before the change said: _`Script error.` events come from a cross-origin script loaded without CORS. Our bundle on `static.shop.test` is one of three candidates; it lacks `Access-Control-Allow-Origin`. Turning on CORS for that host will show whether the errors are ours._ That was enough for the receiver to act without guessing.

## What to put in the report

-   The page's origin and the origin of each script it loads.
-   Which scripts carry `crossorigin` and which responses carry `Access-Control-Allow-Origin`.
-   The Console text from a reproduction with DevTools open, which is not muted.
-   The time and page of the tracked events.

## Questions

### Does `crossorigin` send cookies to the script host?

With `crossorigin="anonymous"`, the browser sends credentials only to a same-origin host. `crossorigin="use-credentials"` sends them cross-origin and requires the host to allow credentials. Static assets rarely need credentials.

### Can a browser extension cause `Script error.`?

Yes. Errors from extension scripts injected into the page can surface in the page's handlers. If the events come from a small set of users, compare them with the [incognito test](/learn/works-in-incognito/).

### Why do I see `Script error.` only in production?

Development servers usually serve scripts from the page's own origin. Production often moves them to a CDN on another host, which is when muting starts.

Return to the [method for browser bug reports](/learn/browser-bug-report-evidence/) for the other symptoms in this collection.

## One month of free code review.

New organizations get one calendar month of hosted code review for private and public GitHub repositories. No card or cloud connection required. [Eligibility and fair-use terms](/free-code-review/).

[Start free with GitHub](https://proofline.sh/orgs/plan?offer=free_month)

## Related reading

-   ### [Turn a browser symptom into a bug report another engineer can act on](/learn/browser-bug-report-evidence/)
    
    Network outages The Proofline team November 20, 2026 7 min read
    
-   ### [Map a minified stack trace to source with the exact build's source map](/learn/minified-stack-trace/)
    
    Deployment failures The Proofline team November 20, 2026 4 min read
