JavaScript errors

Browser and runtime JavaScript errors: TypeError, ReferenceError, SyntaxError and promise rejections.

CodeErrorWhat it means
TypeError TypeError: Cannot read properties of undefined (reading 'x') You tried to access a property on a value that is `undefined` (or `null`) — usually data that hasn’t loaded y…
Failed to fetch TypeError: Failed to fetch / NetworkError when attempting to fetch resource The browser couldn’t complete the request at the network level — CORS, DNS, offline, blocked mixed content, o…
module MIME type Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of "text/html" A or dynamic import got HTML back instead of JavaScript.
ReferenceError ReferenceError: x is not defined Code refers to a variable or function name that doesn’t exist in the current scope.
URIError URIError: URI malformed decodeURIComponent/decodeURI received an invalid percent-encoded sequence.
QuotaExceededError QuotaExceededError: Failed to execute 'setItem' on 'Storage': Setting the value exceeded the quota localStorage/sessionStorage is full (about 5 MB per origin) or storage is disabled.
TDZ ReferenceError: Cannot access 'x' before initialization A let/const/class was used before its declaration line ran (temporal dead zone) — often a circular import.
body already used TypeError: Failed to execute 'json' on 'Response': body stream already read A fetch Response body was consumed twice (e.g. calling .text() then .json()).
already declared SyntaxError: Identifier 'x' has already been declared The same let/const/class name was declared twice in the same scope.
ERR_SSL_PROTOCOL_ERROR ERR_SSL_PROTOCOL_ERROR (This site can't provide a secure connection) The browser couldn’t negotiate TLS — the server sent an invalid response, often plain HTTP on the HTTPS port.
TypeError: not a function TypeError: x is not a function You called something as a function, but its value is not a function (it’s undefined, a string, an object…).
AbortError AbortError: The user aborted a request. / signal is aborted without reason A fetch was cancelled through an AbortController (or the browser cancelled it).
await outside async SyntaxError: await is only valid in async functions and the top level bodies of modules await was used inside a function that isn’t async (or in a classic, non-module script).
MIME type not executable Refused to execute script from 'x' because its MIME type ('text/html') is not executable The browser fetched a script but the server labelled it text/html (usually an error page), so it refused to r…
ERR_ABORTED net::ERR_ABORTED 404 (Not Found) The browser cancelled the request — often because it returned an error (404) or the page navigated away.
clipboard write blocked NotAllowedError: Failed to execute 'writeText' on 'Clipboard': Document is not focused. The Clipboard API refused to write — the page isn’t focused, there was no user gesture, or the context isn’t…
reduce empty TypeError: Reduce of empty array with no initial value Array.reduce() ran on an empty array without an initial value.
ERR_CERT_AUTHORITY_INVALID NET::ERR_CERT_AUTHORITY_INVALID (Your connection is not private) The site’s certificate isn’t signed by a CA the browser trusts — self-signed, missing intermediates, or inter…
invalid token SyntaxError: Invalid or unexpected token The code contains a character the parser can’t handle — smart quotes, stray characters or an unterminated str…
invalid selector DOMException: Failed to execute 'querySelector' on 'Document': 'x' is not a valid selector The CSS selector string is invalid — often an ID starting with a digit or containing special characters.
ERR_NAME_NOT_RESOLVED net::ERR_NAME_NOT_RESOLVED (This site can't be reached — server IP address could not be found) DNS couldn’t resolve the hostname in the browser.
invalid array length RangeError: Invalid array length An array was created or resized with a negative, fractional or enormous length.
SyntaxError: JSON SyntaxError: Unexpected token < in JSON at position 0 `JSON.parse()` / `response.json()` received something that isn’t JSON — very often an HTML error page.
TypeError const TypeError: Assignment to constant variable. Code reassigned a variable declared with const.
Object.keys null TypeError: Cannot convert undefined or null to object Object.keys/entries/assign was called with undefined or null.
reading length TypeError: Cannot read properties of undefined (reading 'length') Code checked .length on something that is undefined — typically an array or string that hasn’t loaded.
ERR_CONNECTION_REFUSED net::ERR_CONNECTION_REFUSED (This site can't be reached — refused to connect) The browser reached the host but nothing was listening on that port.
autoplay blocked NotAllowedError: play() failed because the user didn't interact with the document first. The browser blocked media autoplay with sound until the user interacts with the page.
CSP violation Refused to load the script because it violates the following Content Security Policy directive The page’s Content-Security-Policy doesn’t allow that script, style, image or connection source.
invalid regex SyntaxError: Invalid regular expression: /x/: Unterminated group A regex pattern has invalid syntax — unbalanced parentheses/brackets or unescaped special characters.
unexpected end of input SyntaxError: Unexpected end of input The parser reached the end of the code (or JSON) while still expecting more — a missing } ) ] or empty JSON.
unexpected identifier SyntaxError: Unexpected identifier The parser found a name where it expected punctuation — usually a missing comma, operator or quote.
Unexpected token < SyntaxError: Unexpected token '<' (HTML served instead of JavaScript) The browser loaded a .js file but received HTML (an error page or the SPA index.html).
read-only property TypeError: Cannot assign to read only property 'x' of object Code tried to modify a frozen object, a getter-only property, or immutable state.
WebSocket failed WebSocket connection to 'wss://x' failed The browser couldn’t open (or keep) a WebSocket connection.
ERR_BLOCKED_BY_CLIENT net::ERR_BLOCKED_BY_CLIENT A browser extension (ad blocker, privacy tool) blocked the request.
ERR_CERT_DATE_INVALID NET::ERR_CERT_DATE_INVALID (certificate expired) The site’s certificate has expired (or isn’t valid yet) — or the device clock is wrong.
invalid time value RangeError: Invalid time value A Date is invalid (NaN), and toISOString() or a formatting library couldn’t format it.
Script error. Script error. (at line 0) — cross-origin error details hidden An error happened in a script from another origin, and the browser hid the details.
missing ) SyntaxError: missing ) after argument list A function call’s parentheses are unbalanced — often an unescaped quote or a missing comma/plus.
ChunkLoadError ChunkLoadError: Loading chunk 123 failed. A lazily loaded JavaScript chunk couldn’t be downloaded — usually because a new deployment removed the old ha…
invalid string length RangeError: Invalid string length A string grew beyond the engine’s maximum length — usually runaway concatenation or huge JSON.stringify outpu…
circular JSON TypeError: Converting circular structure to JSON JSON.stringify met an object that references itself (directly or through children).
TypeError not iterable TypeError: x is not iterable for…of, spread or destructuring was used on something that isn’t an array/iterable.
blocked a frame SecurityError: Blocked a frame with origin "x" from accessing a cross-origin frame. Script tried to read or modify an iframe (or window) from another origin.
not a constructor TypeError: x is not a constructor new was used with something that isn’t a class/constructor — usually a wrong import.
addEventListener on null TypeError: Cannot read properties of null (reading 'addEventListener') document.querySelector/getElementById returned null, so the element doesn’t exist when the script runs.
TypeError set undefined TypeError: Cannot set properties of undefined (setting 'x') Code assigned a property on a value that is undefined (or null).
RangeError RangeError: Maximum call stack size exceeded A function called itself (directly or indirectly) too many times — usually infinite recursion.
ResizeObserver loop ResizeObserver loop completed with undelivered notifications. A ResizeObserver callback changed layout in a way that triggered another resize in the same frame.