Skip to content

How to fix JavaScript console errors

Best practices1 min readFixes check console-errors

Errors in the console mean something on the page did not work. They are the fastest way to find broken features.

Step by step, with screenshots: Console errors and deprecated APIs: what the report flags →

Check your own site

Runs this check and the other 192, free, in about 45 seconds.

What it is

Console errors are JavaScript errors and failed resources that the browser logs to its developer console while loading your page, such as "Uncaught TypeError" or a script that returns 404. Visitors do not see the console, but they see the result: a slider that stays blank, a form that does not submit or a cookie banner that never appears.

Each error means a script stopped part-way, and one early error often breaks everything that depends on it. Removed plugins whose scripts are still referenced, conflicts between two libraries and blocked third-party tags are the usual causes. Lighthouse lists them as "Browser errors were logged to the console".

OK looks like this: no errors in the console after the page loads; warnings are worth a look but do not break anything. getReport loads the page in a real browser and lists each error with its source.

What a passing site looks like

  • No JavaScript errors while loading the pagewarning · −1.5 ptseffort M

JavaScript errors on load

Why it matters. Each error means a script stopped part-way, so a slider, form or tracker may silently not work for some visitors. Errors also cost time on the main thread.

How to fix it.
  1. Open the technical detail, then the browser console (F12) on the page, and fix the errors from the top; the first one often causes the rest.
  2. Check for plugins or scripts that were removed but are still referenced.

Questions people ask

What are console errors?

Console errors are messages a browser records when something on a page fails: a JavaScript exception, a file that cannot load, a blocked request or a security violation. They appear in the developer console, not on the page, so they can go unnoticed while a feature quietly stops working.

How do you check the browser console for errors?

Open the page, press F12 (or Cmd+Option+J in Chrome on a Mac) and select the Console tab; errors are shown in red with the file and line. Reload the page with the console open to catch errors during loading. getReport lists the errors it sees in the technical detail.

How do you fix console errors?

Start with the first error, because later ones are often side effects. Follow the file and line to find the script: if it belongs to a plugin or tag, update or remove it; if it is a 404, fix or delete the reference; if it is your own code, fix the bug. Reload and check again.

Do console errors affect SEO?

Not directly, but they can. An error that stops content, links or structured data from rendering means Google may index less of the page. Errors also break features visitors use, such as forms and checkouts, and cost main-thread time. Treat them as bugs, not as noise.

Filed under Best practices. Copy is generated from the same catalogue that scores every report, so what you read here is what the report says.