Lingua-e

Error reference

Programming Errors Explained

Learn what common Python and JavaScript errors mean with clear definitions, real code examples, and how to fix them.

KeyErrorPython

A KeyError is raised in Python when you try to access a dictionary key that does not exist.

TypeErrorPython + JavaScript

A TypeError is raised when an operation is applied to a value of the wrong type.

IndexErrorPython

An IndexError is raised in Python when you try to access a list (or other sequence) using an index that is out of bounds.

AttributeErrorPython

An AttributeError is raised in Python when you try to access or call an attribute (a property or method) that does not exist on an object.

NameErrorPython

A NameError is raised in Python when you try to use a variable or function name that has not been defined in the current scope.

ValueErrorPython

A ValueError is raised in Python when a function receives an argument of the correct type but with an inappropriate value.

SyntaxErrorPython + JavaScript

A SyntaxError means the interpreter or compiler cannot parse your code because it violates the grammar rules of the language.

IndentationErrorPython

An IndentationError is a specific form of SyntaxError raised in Python when the indentation of a block of code does not follow the expected pattern.

ImportErrorPython

An ImportError is raised in Python when an import statement fails.

ZeroDivisionErrorPython

A ZeroDivisionError is raised in Python when you attempt to divide a number by zero.

ReferenceErrorJavaScript

A ReferenceError is thrown in JavaScript when you try to use a variable that has not been declared, or when you access a let or const variable before it has been initialized.

RangeErrorJavaScript

A RangeError is thrown in JavaScript when a value is not within the set or range of allowed values for a particular operation.

null is not an objectJavaScript

This error appears in JavaScript (especially in Safari and React Native) when you try to access a property or call a method on a value that is null.

RecursionErrorPython

A RecursionError is raised in Python when a recursive function exceeds the maximum call stack depth, which defaults to 1000 frames.

FileNotFoundErrorPython

A FileNotFoundError is raised in Python when the interpreter tries to open or access a file that does not exist at the given path.

ModuleNotFoundErrorPython

A ModuleNotFoundError is a subclass of ImportError raised when Python cannot locate a module at all.

UnicodeDecodeErrorPython

A UnicodeDecodeError is raised when Python tries to decode a sequence of bytes into a string using a given encoding (such as UTF-8) but encounters bytes that are not valid for that encoding.

AssertionErrorPython

An AssertionError is raised when an assert statement's condition evaluates to False.

NotImplementedErrorPython

A NotImplementedError is raised deliberately by a developer to signal that a method or function has not been implemented yet.

ConnectionErrorPython

A ConnectionError is raised in Python when a network operation fails to establish or maintain a connection.

StopIterationPython

StopIteration is raised by an iterator's __next__() method to signal that there are no more items to produce.

Cannot read properties of undefinedJavaScript

This error is thrown in JavaScript when you try to access a property on a value that is undefined.

X is not a functionJavaScript

This TypeError is thrown in JavaScript when you attempt to call a value as a function, but that value is not a function.

Maximum call stack size exceededJavaScript

This RangeError is thrown in JavaScript when the call stack overflows because too many function calls are nested without returning.

SyntaxError: Unexpected end of JSON inputJavaScript

This SyntaxError is thrown by JSON.parse() when the string it receives is not valid JSON.

UnhandledPromiseRejectionJavaScript

An UnhandledPromiseRejection occurs when a Promise is rejected but no .catch() handler or try/catch inside an async function catches the error.

Too many re-rendersJavaScript

This error is thrown by React when a component enters an infinite rendering loop.

Each child in a list should have a unique "key" propJavaScript

This React warning (which becomes a hard error in some contexts) is shown when you render a list of elements without providing a unique key prop on each element.

ENOENT: no such file or directoryJavaScript

ENOENT is a POSIX error code meaning 'Error NO ENTry'.

EADDRINUSE: address already in useJavaScript

EADDRINUSE is thrown in Node.js when a server tries to bind to a port that is already occupied by another process.

ERR_MODULE_NOT_FOUNDJavaScript

ERR_MODULE_NOT_FOUND is thrown by Node.js when it cannot locate a module specified in an import or require() statement.

Property does not exist on typeJavaScript

This TypeScript compile error (TS2339) is reported when you try to access a property that is not declared in the type of the variable.

Type X is not assignable to type YJavaScript

This TypeScript compile error (TS2322) is reported when you try to assign a value of one type to a variable, parameter, or return type that expects a different, incompatible type.

Object is possibly 'null'JavaScript

This TypeScript compile error (TS18047) is reported when you try to access a property or call a method on a value whose type includes null.

OSErrorPython

OSError is the base class for operating system-related errors in Python.

PermissionErrorPython

PermissionError is raised when trying to perform a file or directory operation without the required permissions.

EOFErrorPython

EOFError is raised when the built-in input() function hits the end of a file or stream without reading any data.

UnicodeEncodeErrorPython

UnicodeEncodeError is raised when Python cannot encode a Unicode string into a specified byte encoding.

RuntimeErrorPython

RuntimeError is a catch-all exception for errors that don't fit a more specific category.

KeyboardInterruptPython

KeyboardInterrupt is raised when the user presses Ctrl+C (or the interrupt key) to stop a running program.

UnboundLocalErrorPython

UnboundLocalError is a subclass of NameError raised when a local variable is referenced before it has been assigned a value.

ConnectionRefusedErrorPython

ConnectionRefusedError is raised when a TCP connection attempt is actively rejected by the target host.

TimeoutErrorPython

TimeoutError is raised when a socket or I/O operation exceeds the time limit set by a timeout.

MemoryErrorPython

MemoryError is raised when a Python operation cannot allocate enough memory to complete.

OverflowErrorPython

OverflowError is raised when an arithmetic operation produces a result too large to be represented within the numeric type.

BrokenPipeErrorPython

BrokenPipeError is raised when a process tries to write to a pipe whose reading end has been closed.

NotADirectoryErrorPython

NotADirectoryError is raised when a directory operation is attempted on a path that is not a directory.

Circular Import ErrorPython

A circular import occurs when module A imports from module B, and module B also imports from module A.

SystemExitPython

SystemExit is raised by sys.exit() to signal that the interpreter should terminate.

JSONDecodeErrorPython

json.JSONDecodeError is raised when json.loads() or json.load() receives a string that is not valid JSON.

CalledProcessErrorPython

subprocess.CalledProcessError is raised when a subprocess called with check=True exits with a non-zero return code.

SSLCertVerificationErrorPython

ssl.SSLCertVerificationError is raised when Python's SSL layer cannot verify the server's TLS certificate.

re.errorPython

re.error is raised when a string passed to a function in the re module is not a valid regular expression.

Dataclass Mutable Default ErrorPython

Python's dataclass decorator raises a ValueError when a field is given a mutable default value (list, dict, set, etc.).

Cannot Set Property of UndefinedJavaScript

This TypeError is thrown when you try to assign a property to a value that is undefined.

Assignment to Constant VariableJavaScript

This TypeError is thrown at runtime when you attempt to reassign a variable declared with const.

Identifier Already DeclaredJavaScript

This SyntaxError is thrown when let or const is used to declare a variable name that already exists in the same scope.

CORS ErrorJavaScript

A CORS (Cross-Origin Resource Sharing) error occurs when a browser blocks a fetch or XMLHttpRequest to a different origin because the server's response does not include the required Access-Control-Allow-Origin header.

Invalid DateJavaScript

An Invalid Date object is silently created when new Date() receives a string it cannot parse.

NaN in ArithmeticJavaScript

NaN (Not a Number) is a special IEEE 754 value that propagates silently through calculations.

Destructuring UndefinedJavaScript

This TypeError occurs when you try to destructure properties from a value that is null or undefined.

Spread Non-IterableJavaScript

This TypeError is thrown when the spread operator (...) is used on a value that does not implement the iterable protocol.

Promise.all RejectedJavaScript

Promise.all() rejects immediately when any one of its input promises rejects, discarding the results of all other promises even if they succeed.

Illegal InvocationJavaScript

This TypeError is thrown when a built-in method is called with the wrong 'this' context.

localStorage Quota ExceededJavaScript

A QuotaExceededError (DOMException) is thrown when a write to localStorage or sessionStorage would exceed the browser's storage limit, typically around 5 MB per origin.

Class Extends Non-ConstructorJavaScript

This TypeError is thrown when the value after 'extends' is not a constructor function or class.

Strict Mode: 'this' is undefinedJavaScript

In strict mode, a regular function called without an explicit receiver has 'this' set to undefined instead of the global object.

JSON Circular ReferenceJavaScript

JSON.stringify() throws a TypeError when the object graph contains a circular reference, meaning an object refers back to itself (directly or indirectly).

Fetch Network ErrorJavaScript

fetch() rejects with a TypeError when a network-level failure prevents the request from completing.

Event Listener Memory LeakJavaScript

Event listener memory leaks occur when listeners are added repeatedly without being removed, causing the count to grow indefinitely.

Promise Resolve Called TwiceJavaScript

Calling resolve() or reject() more than once inside a Promise constructor is silently ignored.

Generator Already ClosedJavaScript

Once a generator function returns (or its body is exhausted), calling .next() on it returns { value: undefined, done: true } silently rather than throwing an error.

TS7006: Implicit AnyJavaScript

TypeScript error TS7006 is reported when a function parameter has no type annotation and TypeScript cannot infer its type, so it would default to 'any'.

TS2304: Cannot Find NameJavaScript

TypeScript error TS2304 is reported when an identifier is used but TypeScript cannot find a declaration for it in the current scope.

TS2307: Cannot Find ModuleJavaScript

TypeScript error TS2307 is reported when a module import cannot be resolved.

TS2366: Not All Code Paths ReturnJavaScript

TypeScript error TS2366 is reported when a function is declared to return a specific type but has at least one code path that reaches the end of the function without a return statement.

TS2769: No Overload MatchesJavaScript

TypeScript error TS2769 is reported when a function call does not match any of the declared overload signatures.

TS2540: Readonly ViolationJavaScript

TypeScript error TS2540 is reported when code attempts to assign to a property marked as readonly.

TS7053: No Index SignatureJavaScript

TypeScript error TS7053 occurs when you use a dynamic string key to access an object that has no index signature.

TS2344: Generic Constraint ViolationJavaScript

TypeScript reports this error when a type argument does not satisfy the constraints declared for a generic type parameter.

TS18048: Possibly UndefinedJavaScript

TypeScript error TS18048 is reported when a value that might be undefined is accessed without a null check.

TS2515: Abstract Member Not ImplementedJavaScript

TypeScript error TS2515 is reported when a concrete (non-abstract) class extends an abstract class but does not implement all of its abstract members.

Invalid Hook CallJavaScript

React throws this error when a hook (useState, useEffect, etc.) is called outside the body of a function component or custom hook.

Objects Not Valid as React ChildJavaScript

React can only render strings, numbers, booleans, null, undefined, and React elements as children.

Nothing Was Returned from RenderJavaScript

React requires every function component to return a React element, null, or undefined.

Hydration FailedJavaScript

React 18's hydration error occurs when the HTML sent from the server does not match the component tree that React tries to render on the client.

Cannot Update During RenderingJavaScript

React warns when a component's setState is triggered while another component is in the middle of its render phase.

Rendered Fewer Hooks Than ExpectedJavaScript

React tracks hooks by their call order.

useEffect Missing DependencyJavaScript

A missing dependency in useEffect's dependency array causes a stale closure bug: the effect captures an outdated value of a variable and continues using it even after the variable has changed.

Context Without ProviderJavaScript

useContext() returns the default value passed to createContext() when there is no matching Provider in the component tree above it.

ECONNRESETJavaScript

ECONNRESET is a Node.js network error that occurs when a TCP connection is forcibly closed by the remote peer while data is still being transferred.

ETIMEDOUTJavaScript

ETIMEDOUT is a Node.js network error code indicating that a network operation (connection attempt or data transfer) did not complete within the allowed time.

JavaScript Heap Out of MemoryJavaScript

This fatal error crashes the Node.js process when the V8 JavaScript heap is exhausted.

ERR_REQUIRE_ESMJavaScript

Node.js throws ERR_REQUIRE_ESM when a CommonJS require() call tries to load an ES Module.

ERR_INVALID_ARG_TYPEJavaScript

Node.js throws ERR_INVALID_ARG_TYPE when a built-in API function receives an argument of the wrong type.

npm Peer Dependency ConflictJavaScript

npm throws a peer dependency conflict (ERESOLVE) when a package requires a specific version of another package that is incompatible with what is currently installed.

Socket Hang UpJavaScript

The 'socket hang up' error occurs in Node.js when an HTTP connection is closed by the server before a complete response is received.

spawn ENOENTJavaScript

Node.js throws a spawn ENOENT error when child_process.spawn() cannot find the executable specified.

MaxListenersExceededWarningJavaScript

Node.js emits this warning when more than 10 listeners (the default maximum) are added to a single event on an EventEmitter.

ERR_PACKAGE_PATH_NOT_EXPORTEDJavaScript

Node.js throws ERR_PACKAGE_PATH_NOT_EXPORTED when you try to import a file path from a package that uses the 'exports' field in package.json to restrict which paths are publicly accessible.