Common errors, explained
What each one actually means, the handful of things that usually cause it, and a working fix for each.
Python
IndexError: list index out of range
You asked for an index the list does not have. Almost always a loop bound that is one too far, or an empty list you assumed had items.
IndexError: string index out of range
Same cause as the list version: you asked for a character position the string does not have.
AttributeError: 'NoneType' object has no attribute
Something returned None and you called a method on it. Usually a lookup that failed, or a function that forgot to return.
TypeError: unsupported operand type(s) for +: 'int' and 'NoneType'
You did arithmetic with a None. Something in the sum was missing and nobody checked.
UnboundLocalError: cannot access local variable
You assigned to a name somewhere inside a function, which made it local for the whole function — including before the assignment runs.
RecursionError: maximum recursion depth exceeded
A function kept calling itself without reaching a stopping condition.
list.sort() returns None
sort() sorts in place and gives back None. Assigning its result throws the list away.
TypeError: '>' not supported between instances of 'str' and 'int'
You compared text with a number. The value arrived as a string and was never converted.
TypeError: list indices must be integers or slices, not float
You used a float as an index. In Python 3, / always produces a float — even when the result looks whole.
JavaScript
TypeError: Cannot read properties of undefined
You read a property off something that does not exist. The crash is usually far from the real mistake — the value went missing earlier.
ReferenceError: Cannot access before initialization
You used a let or const before its declaration line executed. This is the temporal dead zone.
[object Promise] in output
A promise was used where its resolved value was expected — nearly always a missing await.
Not listed? Step through your code to see exactly where the value goes wrong, or read about the bug patterns behind them.