JavaScript documented errors
Browse documented JavaScript errors with exact messages, troubleshooting context, and practical remediation steps.
Classes
Classes errors
ReferenceError: super() called twice in derived class constructorJavaScript called super twice in a derived class constructorJavaScript rejected a class constructor because super() was invoked more than once in a derived class.
SyntaxError: Unexpected '#' used outside of class bodyJavaScript private field syntax was used outside a class bodyJavaScript encountered private field syntax in a location where class private names are not allowed.
Json
Json errors
TypeError: BigInt value can't be serialized in JSONJavaScript BigInt value cannot be serialized in JSONJavaScript failed to stringify data because JSON does not support BigInt values directly.
SyntaxError: JSON.parse: bad parsingJavaScript JSON.parse failed because the JSON is invalidJavaScript could not parse a JSON string because the input is not valid JSON syntax.
TypeError: cyclic object valueJavaScript tried to serialize a circular objectJavaScript found a circular reference while attempting to serialize an object to JSON.
Modules
Modules errors
Operators
Operators errors
SyntaxError: cannot use ?? unparenthesized within || and && expressionsJavaScript mixed ?? with || or && without parenthesesJavaScript does not allow nullish coalescing to be combined directly with logical OR or AND without explicit grouping.
TypeError: cannot use 'in' operator to search for 'x' in 'y'JavaScript used the in operator on a non-object valueJavaScript rejected the in operator because the right-hand side is not an object that can be searched for properties.
Regex
Regex errors
SyntaxError: nothing to repeatJavaScript regular expression has nothing to repeatJavaScript rejected the regular expression because a repetition operator like *, +, or ? does not follow a valid token.
SyntaxError: invalid regular expression flagJavaScript regular expression used an invalid flagJavaScript rejected a regular expression because one of the supplied flags is unsupported or malformed.
Runtime
Runtime errors
ReferenceError: can't access lexical declaration before initializationJavaScript accessed a let or const binding before initializationJavaScript tried to read a let, const, or class binding while it was still in the temporal dead zone.
ReferenceError: assignment to undeclared variableJavaScript assigned to an undeclared variableJavaScript threw because code assigned to a variable that was never declared in the current scope.
TypeError: class constructors must be invoked with 'new'JavaScript class constructor was called without newJavaScript tried to call a class constructor like a normal function instead of instantiating it with new.
RangeError: x can't be converted to BigInt because it isn't an integerJavaScript could not convert a non-integer value to BigIntJavaScript rejected a conversion to BigInt because the source numeric value is not an integer.
URIError: malformed URI sequenceJavaScript could not decode or encode a malformed URI sequenceJavaScript hit invalid percent-encoding or malformed Unicode data while processing a URI component.
InternalError: too much recursionJavaScript hit too much recursionJavaScript exceeded the call stack because recursion never terminated or a getter, setter, or callback kept calling itself indirectly.
TypeError: can't convert BigInt to numberJavaScript mixed BigInt and Number in an unsupported wayJavaScript rejected an operation because BigInt and Number values were mixed in a context that requires explicit conversion.
RangeError: precision is out of rangeJavaScript number formatting precision is out of rangeJavaScript rejected a numeric formatting call because the requested precision is outside the supported range.
RangeError: invalid dateJavaScript produced an invalid dateJavaScript encountered an invalid Date value, often when converting or formatting a date that could not be parsed correctly.
TypeError: Reduce of empty array with no initial valueJavaScript reduce was called on an empty array without an initial valueJavaScript could not reduce an empty array because no initial accumulator value was provided.
RangeError: repeat count must be non-negativeJavaScript string repeat count was negativeJavaScript rejected a string repeat operation because the repeat count was negative.
RangeError: repeat count must be less than infinityJavaScript string repeat count was too largeJavaScript rejected a string repeat operation because the requested output would be too large.
TypeError: x is not a functionJavaScript tried to call something that is not a functionJavaScript attempted to invoke a value as a function, but the value is not callable.
RangeError: invalid array lengthJavaScript tried to create an array with an invalid lengthJavaScript rejected an array length because it was negative, non-integer, or too large for the runtime.
RangeError: BigInt division by zeroJavaScript tried to divide a BigInt by zeroJavaScript threw because a BigInt division or remainder operation used 0n as the divisor.
TypeError: null/undefined has no propertiesJavaScript tried to read properties from null or undefinedJavaScript attempted property access on a value that is null or undefined.
TypeError: invalid assignment to constJavaScript tried to reassign a const variableJavaScript threw because code attempted to assign a new value to a constant binding.
TypeError: x is not a constructorJavaScript value is not a constructorJavaScript tried to instantiate a value with new, but that value is not constructable.
TypeError: x is not iterableJavaScript value is not iterableJavaScript expected an iterable for spread syntax, for...of, destructuring, or APIs like Promise.all, but received a non-iterable value.
ReferenceError: x is not definedJavaScript variable or symbol is not definedJavaScript tried to use a variable, function, or imported name that does not exist in the current scope.
Syntax
Syntax errors
SyntaxError: missing ) after argument listJavaScript call or expression is missing a closing parenthesisJavaScript could not parse the expression because a function call or similar construct is missing a closing parenthesis.
SyntaxError: missing = in const declarationJavaScript const declaration is missing an initializerJavaScript rejected a const declaration because const variables must be initialized when declared.
SyntaxError: duplicate formal argumentJavaScript function declared the same parameter twiceJavaScript rejected a function definition because the same parameter name appeared more than once.
SyntaxError: Unexpected tokenJavaScript parser hit an unexpected tokenJavaScript encountered syntax it did not expect at that point in the file, usually because nearby code is malformed or in the wrong context.
SyntaxError: return not in functionJavaScript return statement is outside a functionJavaScript found a return statement where function return semantics do not apply, such as top-level script code.
SyntaxError: string literal contains an unescaped line breakJavaScript string literal contains an unescaped line breakJavaScript encountered a string literal that spans lines without proper escaping or template literal syntax.
SyntaxError: invalid assignment left-hand sideJavaScript tried to assign to something that is not assignableJavaScript found an assignment target that cannot appear on the left side of =, such as the result of an expression.
SyntaxError: await is only valid in async functions, async generators and modulesJavaScript used await outside a valid async contextJavaScript found an await expression in code that is not an async function, async generator, or top-level module context.