On this page
What this issue is
JavaScript is the code that makes a page interactive. When a script hits something it cannot do, such as reading a property of undefined or calling a function that does not exist, it throws an error. If nothing catches that error, it is called an uncaught exception. The browser prints it in the console and stops running that script from that line onward.
The damage depends on what the failed script was responsible for. A visitor sees a normal-looking page, but something behind it is dead. You may not notice because the page still loads.
- Form validation or submit handlers that never attach, so the button does nothing or the form posts incorrectly
- Buttons for chat, booking, menus or add to cart that never respond
- Tracking tags and pixels that were set to start after the failing code, so conversions are not reported to ad platforms
- Consent banners that fail to show, which can leave tags blocked or running without the right consent state
- Page content that is meant to be rendered by script, such as pricing, product options or a checkout step
- Page loadsHTML and CSS display normally
- Script throwsUncaught TypeError stops the script
- Form handlerNever attached
- Tracking tagNever fires
- Lead or saleNot completed or not reported
The script fails at one line, so everything it should have done afterwards is lost.
The visitor sees the page, while the console shows an uncaught error.
Open DevTools
Press F12, or Ctrl+Shift+J (Windows) or Cmd+Option+J (Mac) in Chrome, to open the Console.
Reload the page
Errors that happen on load only appear if the console is open before the page loads. Tick Preserve log if the page redirects.
Read the red entries
Note the message and the file and line on the right, for example app.js:42. Click it to open the code in the Sources panel.
Identify who owns the script
Check the URL. Your theme or bundle, a plugin, a tag manager container or a third-party domain each have a different owner and fix.
Repeat on key pages and devices
Test the landing page, form page and checkout, in a private window with extensions off, and on mobile. Browser extensions can cause errors that visitors never see.
The fix depends on the message and who owns the script. Start with the most common causes in the table, then use the platform steps.
| Message | Likely cause | Typical fix |
|---|---|---|
| Cannot read properties of null | Code looks for an element that is not on the page yet or was renamed | Run the code after the page is ready, or check the element exists first |
| x is not defined | A library did not load, loaded later, or was blocked | Load the library first, fix its URL, or remove code that needs it |
| Unexpected token '<' | A script URL returned an HTML page, often a 404 | Fix the file path or redeploy the missing file |
| Unexpected token | Syntax error, or a script was changed or minified badly | Restore the last working version of the file or snippet |
| $ is not a function / jQuery is not defined | A script using jQuery runs before jQuery loads | Load jQuery first or remove the dependent script |
Find the source file
In the console error, check the path. /wp-content/plugins/name/ points to a plugin, /wp-content/themes/name/ to your theme.
Isolate the cause
On a staging copy, deactivate plugins one by one, or switch to a default theme, and reload until the error disappears.
Check optimisation settings
If the error began after turning on minify, combine or delay JavaScript in a caching or speed plugin, switch that option off, clear the cache and retest.
Update or replace
Update the plugin or theme, or contact its developer with the exact error text, or replace it.
Find the source
Check whether the file is from your theme (cdn.shopify.com/.../assets) or an app script.
Test with a clean theme
Duplicate the theme, then in the copy remove recently added code in theme.liquid and any snippets, and reload.
Check apps
Disable or uninstall recently added apps one at a time and check the console after each. Remove leftover app code from theme files.
Use Preview mode
Open Preview, load your site and look for Custom HTML tags marked as failed, or errors in the console from gtm.js.
Fix the Custom HTML tag
Open the tag's code and look for typos, missing script tags or code that needs a library that is not loaded.
Pause or revert
Pause the faulty tag, or roll back to the previous container version under Versions, then publish.
Check custom code
Review Site settings > Custom code and the page's own custom code for the script named in the error.
Fix or remove it
Correct the code, or remove the embed, then publish and retest on the live domain, not just the staging one.
Check custom code areas
Review Custom JS or Custom Code in the funnel or page settings and any custom code elements.
Remove or correct
Fix the failing code or remove it, save, publish and retest the live funnel URL.
Check added code
Review Settings > Custom code (Advanced) and any embed elements for the failing script.
Fix or remove
Correct the snippet or delete it, publish and retest. If the error comes from Wix's own files, contact Wix support.
Check code injection
Review Settings > Advanced > Code injection, and any Code blocks on the page.
Fix or remove
Correct the code or remove the block, save and retest on the live site.
Use source maps
Open the failing line in Sources. With source maps, DevTools shows the original file and line instead of the minified one.
Guard the failing code
Check that values exist before using them, and run DOM code after the page is ready.
Add a global error listener
Log uncaught errors so you can see them in your own logs.
document.addEventListener('DOMContentLoaded', function () {
var form = document.querySelector('#lead-form');
if (!form) return; // element missing on this page, do nothing
form.addEventListener('submit', function (e) {
// your handler
});
});window.addEventListener('error', function (event) {
navigator.sendBeacon('/log-js-error', JSON.stringify({
message: event.message,
source: event.filename,
line: event.lineno,
page: location.href
}));
});Before
- Red Uncaught TypeError on every load
- Form button sometimes does nothing
- Conversion tag missing from the network tab
After
- Console has no uncaught errors from your own code
- Form submits and shows a confirmation
- Conversion tag request appears after submit
- Reload the page with the console open and no red uncaught errors from your own scripts
- Test in a private window with extensions off, on desktop and mobile
- Submit a test lead and confirm the thank-you step and the email or CRM entry
- Check the Network tab or your tag tool to confirm the tracking requests fire
- Clear your site and CDN cache first, so you are not testing an old file
Most load errors appear after a change: a theme or plugin update, a new tag, a speed setting or a deploy. Make the console check part of every change.
- Test on a staging copy and check the console before publishing
- Change one thing at a time so the cause is obvious
- Keep a record of which scripts and tags are on each funnel page
- Use GTM versions so you can roll back a bad tag quickly
- Re-test key pages after every update, deploy or tag change
- Monitor your funnel pages on a schedule instead of waiting for a customer to complain
Day 0
A plugin update changes a script and it starts throwing on load
Day 1
The page looks normal, so nobody notices
Day 4
Reported conversions drop, but the cause is unclear
Day 5
Someone opens the console, finds the error and rolls back
FunnelGuard detects this today. When its robot visitor loads your pages and runs your journeys on a schedule, it captures page errors, meaning uncaught JavaScript exceptions raised by the page. A failure is re-checked from a second region before one alert goes out, with a screenshot and a likely cause.
If the error only happens after clicking submit, a dead button, or a script blocked by security rules, see the related guides below.
Questions people ask
Why is my website showing an uncaught JavaScript error?
A script on the page hit a problem, such as reading a missing element or calling a function that is not defined, and nothing handled it. Open the Console in DevTools and reload to see the message, file and line. Those tell you whether your theme, a plugin, a tag or a third-party script is the cause.
How do I find which script is causing the error?
Open DevTools, reload with the Console open and click the file and line link beside the red error. The URL shows who owns the script. If it is minified, use source maps or disable plugins, apps or tags one at a time until the error disappears.
Does a JavaScript error stop my form from working?
It can. If the error happens before the form's script attaches its handlers, validation or submit code may never run. Some forms still post normally without JavaScript, so test with a real test submission rather than guessing.
Can a JavaScript error stop my tracking pixels?
Yes. If a tag is set to start from code that runs after the failing line, it never fires, so conversions are not reported to GA4 or ad platforms. Tags loaded separately may still work, so check the Network tab for the tracking requests.
Why do I see errors in my console that visitors do not?
Browser extensions inject their own scripts and can cause errors, often shown as chrome-extension:// files. Test in a private window with extensions disabled to see what visitors see.
Do all console errors hurt conversions?
No. Some are harmless, like a missing icon or a blocked ad script. Focus on uncaught errors from your own scripts on funnel pages, and then check whether forms, buttons and tags still work.
How can I be alerted when a JavaScript error appears on my site?
You can add your own error logging, or use monitoring that loads your pages on a schedule. FunnelGuard captures uncaught page errors during its scheduled journey runs and sends one alert, after re-checking from a second region, with a screenshot and a likely cause.
Related issues
- PRF-117Console error on a funnel stepFix guide
- PRF-118Unhandled promise rejectionFix guide
- PRF-120JS error only after clicking submit breaks the formFix guide
- PRF-121Script error from a cross-origin script ('Script error.' with no detail)Fix guide
- PRF-134Button does nothing on click (dead click)Fix guide
- PRF-135Form submits but shows no feedback (silent failure)Fix guide