Blog › Bugs and site errors › What Is a Script Error, and How Do You See the Real Cause?
Noibu blog

What Is a Script Error, and How Do You See the Real Cause?

What is a script error, and how do you see the real cause?

A script error is a JavaScript error thrown by a script loaded from another domain, which the browser reports only as Script error. with no message, file or line number. Browsers hide the details for cross-origin security. Adding crossorigin=anonymous to the script tag and an Access-Control-Allow-Origin header on its server reveals the real error.

Last updated November 24, 2026

If your error logs are full of entries that say only Script error., you are looking at real failures with their details deliberately removed. On an online store, those failures often come from the third-party scripts closest to revenue: payment SDKs, tag managers, reviews, chat and checkout widgets. This guide explains what a script error is, why browsers hide it, how to see the real cause, and how to tell which ones are costing orders.

Key takeaways

  • Script error. is what the browser reports when a cross-origin script throws an error and the page is not allowed to read its details.
  • It is not one bug and not malware. It is many different failures sharing one generic label.
  • To see the real message and stack, load the script with crossorigin=anonymous and serve it with an Access-Control-Allow-Origin header.
  • Rank script errors by the sessions and revenue they affect, starting with the ones that fire in cart and checkout.

Part of: Noibu's Bug Resolution Agent

What is a script error?

A script error is the generic message a browser reports to a page's error handlers when a script loaded from a different origin throws an exception. Instead of the error message, file name, line number and stack trace, the page receives only the text Script error. with the details stripped. The failure is real; the browser is withholding the information.

Origin means the combination of protocol, domain and port. A store at www.example.com that loads a reviews widget from a vendor's CDN, a tag manager from Google, or its own assets from a separate static domain is loading cross-origin scripts. Any of them can produce a script error.

Why do browsers hide the details of script errors?

Browsers hide cross-origin error details to stop one site from reading information about another. Without that rule, a page could load a script from a site where the visitor is logged in and learn private details from the error it throws. The same-origin policy blocks that, so error handlers on your page only see the generic message unless the script's owner explicitly allows access.

MDN's reference for the crossorigin attribute describes this directly: for script elements loaded without CORS, access to error logging through window.onerror is limited.

How do you see the real cause of a script error?

Two changes are needed, one on your page and one on the server that hosts the script. Noibu's help article on what a script error is describes the same two methods.

First, add the crossorigin attribute to the script tag. Setting crossorigin="anonymous" tells the browser to request the script using CORS without sending cookies or credentials to another origin:

<script src="https://cdn.example-vendor.com/widget.js" crossorigin="anonymous"></script>

Second, the server hosting the script must return a CORS header that allows your origin to read it, such as Access-Control-Allow-Origin: *, as described in MDN's reference for the Access-Control-Allow-Origin header. Many large script providers already send this header, so the attribute alone is enough for their scripts. For scripts on your own static domain, you need access to the server or CDN configuration to add it. If the attribute is added but the header is missing, the browser blocks the script entirely, so test before releasing.

How to unmask a script error

  1. STEP 1

    Find the source

    Use the page and timing of the error to narrow down which cross-origin scripts were running.

  2. STEP 2

    Add crossorigin

    Add crossorigin=anonymous to that script tag in your theme or tag manager.

  3. STEP 3

    Confirm the header

    Check that the script response includes Access-Control-Allow-Origin for your domain.

  4. STEP 4

    Add source maps

    If the script is minified and yours, publish source maps so the stack points at real code.

  5. STEP 5

    Read the real error

    The next occurrence reports the full message, file, line and stack trace.

What if you cannot change the third-party script?

Some vendors inject their own script tags or serve files without CORS headers, so you cannot add the attribute or the header. In that case, the error stays masked, but you can still learn a lot from context: which page it fires on, which step of the funnel, which browsers and devices, and what the shopper did just before. That context is often enough to show the vendor that their script is failing and on which pages.

Script errors from minified bundles on your own domain are a different case. They show a message and line, but the stack points at compressed code. Publishing source maps lets error tools map the stack back to the original file and line.

Script error versus a regular JavaScript error

How the browser reports errors from first-party and cross-origin scripts.
Regular JavaScript errorScript error
Where the code comes fromSame origin as the pageA different origin, such as a vendor CDN
What error handlers receiveMessage, file, line, column and stackOnly Script error. with no details
How to debugRead the stack traceEnable CORS on the script first, or use session context
Typical sources on a storeTheme code, custom checkout logicPayment SDKs, tags, reviews, chat, personalization

Which script errors should an online store care about?

Most script errors are harmless: an analytics tag that fails once, a widget that retries and succeeds. A few break something a shopper needs, such as an address lookup, a shipping calculator, a payment button or a promo code field. Because script errors look identical, a revenue-blocking one can hide among thousands of harmless ones.

The way to separate them is to tie each error to the sessions where it occurred and to what happened next. A script error that fires on the payment step in sessions that then abandon matters far more than one that fires on every page in sessions that still convert. Our guides on how JavaScript errors affect ecommerce revenue, what causes failed to fetch errors and finding which third-party scripts slow your store cover related third-party problems.

How does Noibu's Bug Resolution agent handle script errors?

Noibu detects script errors on every session and separates distinct script errors by their signature, which in Noibu always begins with script error. Noibu's Bug Resolution agent identifies the top issues, estimates how many sessions and how much revenue each one affects, traces the root cause to your codebase where the code is yours, and creates a pull request for your review. For third-party scripts it cannot change, it shows where the error fires and what shoppers experienced, so you can take the evidence to the vendor. Nothing ships without your approval.

The Bug Resolution agent is one of six Noibu agents. Bug Resolution, Performance, CRO, ADA, A/B Testing and ROAS agents work in the Noibu console and in Claude, ChatGPT and other AI tools through Noibu MCP.

Frequently asked questions

What does Script error. mean in the browser console?
It means a script loaded from another domain threw an error, and the browser is hiding the message, file, line and stack trace because of cross-origin security rules.
Is a script error a virus?
No. A script error is an ordinary JavaScript error from a cross-origin script with its details hidden. It does not mean your site has been hacked.
How do I get the details of a script error?
Add crossorigin=anonymous to the script tag and make sure the script server returns an Access-Control-Allow-Origin header that allows your domain. The browser then reports the full error.
What is the difference between a script error and a JavaScript error?
A script error is a JavaScript error from a cross-origin script whose details are hidden. A JavaScript error from your own origin includes the full message, file, line and stack.
Why do script errors matter for ecommerce?
Payment SDKs, checkout widgets and tags are common sources. A masked error in checkout can stop shoppers from paying while looking identical to harmless errors elsewhere.
How does Noibu help with script errors?
Noibu separates distinct script errors, ties each to the sessions and revenue it affects, and its Bug Resolution agent traces causes in your code and creates a pull request for your review.

A script error is a real failure with its details hidden. Unmask the scripts you control with the crossorigin attribute and a CORS header, use session context for the ones you cannot, and rank every script error by what it costs in checkout. Noibu's Bug Resolution agent does that ranking and hands each change back for your approval.

Noibu is AI for ecommerce operations, the always-on optimization system that keeps online stores running at their best. A team of supervised AI agents finds what's broken, slow, or leaking revenue, does the work, and hands results back for human approval. Trusted by retailers like Free People, Guess, Liquid I.V., and Ariat.

Back to all blogs
‍
‍
See what Noibu’s AI agents would change on your store first.
Free website audit
Share

Keep your store running at its best, with AI agents that never clock out.