squirrelscan
GitHub

JavaScript errors and failed requests: what breaks after load

A page can answer 200 with clean HTML and still throw an uncaught exception, fail to hydrate or leave a section empty after an API call answers 500. squirrel reads the errors the cloud render recorded and groups them across the site.

What this rule detects

Clean HTML says nothing about what the browser does next. An uncaught TypeError can stop the menu, the form or the checkout from working. A framework hydration mismatch makes React or Vue discard the server HTML and render again. ChunkLoadError: Loading chunk 123 failed appears after a deploy removes a code-split chunk. A fetch('/api/data') made after load answers 500 and a section stays empty.

This rule reads what the browser reported while the page ran: uncaught exceptions, console.error messages and requests that failed at runtime, from the optional runtime block of each render result. The cloud renderer does not record that block yet; that work is tracked privately. Until it does, the rule is skipped on every audit and listed under Not checked with the reason runtime-not-recorded. It never passes.

It needs a rendered page, so it is a cloud check. A local or --http audit does not run it and lists it among the cloud checks that did not run, with the prompt to run a cloud audit.

What squirrel checks

The rule is site-wide. It groups findings across pages by normalised message and source file, so one exception on 14 pages is one finding with a page count and sample pages, not 14.

  • Error: an uncaught exception thrown from a first-party script. First-party means the same registrable domain as the site. An inline script counts as first-party. Check name js-errors.
  • Warning, hydration: a hydration mismatch, recognised by message: React “Hydration failed” and minified errors #418, #423 and #425, and Vue “Hydration … mismatch”. Check name hydration-errors.
  • Warning, requests: a first-party request made after load that answers 5xx or 404. Check name failed-runtime-requests.
  • Warning, console: a console.error from first-party code. Check name console-errors.
  • Warning, third party: any exception, console error or failed request from another registrable domain. Check name third-party-js-errors.
  • Not reported: 401 and 403 from the site’s own API (normal for a signed-out visitor), requests the renderer blocked or aborted, net::ERR_ABORTED on beacons and navigation, ResizeObserver loop messages, Chrome’s Failed to load resource echo of a request that is already reported, CSP violations (owned by the CSP violations rule), and pages that answered with a WAF or bot challenge.
  • Not checked: a page the rule has to judge with no runtime data (the render recorded none, or there is no render result for it) is a gap, skip reason runtime-not-recorded. If no page has runtime data, the js-errors check is skipped with that reason. If only some pages do, the rule still reports what it saw on them and adds a skipped check named unchecked-pages with that reason instead of a pass, so a finding from an earlier audit is not marked fixed while part of the site went unseen. A pass needs runtime data from every page the rule judged. A WAF or bot challenge page is left out and only noted, as an information unchecked-pages check. If every rendered page was a challenge, the rule read nothing and is skipped with the reason unread-page, so a finding from an earlier audit is not marked fixed.

How to fix it

Fix the error at the source file and line in the finding. For a hydration mismatch, make the server and the client render the same markup: avoid Date.now(), random values and browser-only checks during render.

// Differs between server and client: hydration mismatch
const label = `Updated ${new Date().toLocaleTimeString()}`;

For a ChunkLoadError after a deploy, keep the previous release’s hashed chunks online while cached pages may still reference them. For a failing API call, fix the endpoint or handle the failure in the UI. For a third-party failure, check the provider or remove the tag.

Rule IDreliability/js-errors
CategoryReliability
ScopeSite-wide
CloudYes, needs a rendered page
Severityerror for first-party uncaught exceptions; warning for hydration, failed requests, console errors and third-party failures
Weight6/10

Enable / disable

Disable this rule

[rules]
disable = ["reliability/js-errors"]

Disable all Reliability rules

[rules]
disable = ["reliability/*"]

Enable only this rule

[rules]
enable = ["reliability/js-errors"]

enable replaces the default ["*"], so this is the only rule selected. Leave disable out: a rule that matches any disable pattern is skipped even when enable names it.

Check names by outcome

Each check name this rule can emit, by what it means to a tool comparing two audits. A problem check is a finding. A clean check says the rule ran over what it covers and found nothing; it clears the problem checks listed beside it, so a finding is fixed when the rule ran over the same scope and a clean check took its place. A not checked check says the rule did not evaluate, and never clears a finding.

Check nameOutcomeClears
js-errorsProblem
hydration-errorsProblem
failed-runtime-requestsProblem
console-errorsProblem
third-party-js-errorsProblem
js-errorsCleanjs-errors, hydration-errors, failed-runtime-requests, console-errors, third-party-js-errors
js-errorsNot checked
unchecked-pagesNot checked

References

Check your site

Run a cloud audit of https://example.com and open the Reliability section of the report. Each error lists its message, source file and the pages it appears on. Local audits list this rule among the cloud checks that did not run.

Type to search…

↑↓ navigate↵ openesc close