Programming Errors
50 errors
Common programming errors and how to fix them.
50 / 50
- 1
Syntax Error
Your code has a structural problem — a missing bracket, quote, or punctuation that makes it impossible to parse.
- 2
Type Error
You tried to use a value in a way that doesn't match its type — like calling `len()` on a number or adding a string to an integer.
- 3
Name Error
You referenced a name (variable, function, class) that doesn't exist in the current scope.
- 4
Undefined Variable
The variable exists but has no value — it is `undefined`, and using it as if it has one causes problems.
- 5
Null Value Problem
You operated on a value that is `null` — calling a method or reading a property on `null` causes an error.
- 6
Infinite Loop
Your loop never stops — the condition that should end it is always true or the loop variable never changes.
- 7
Wrong Condition
Your condition evaluates to the wrong true/false value, so your code takes the wrong path or loops the wrong number of times.
- 8
Index Out of Range
You tried to read or write a position in an array that is outside its valid range of indices.
- 9
Off-By-One Error
Your loop runs one time too many or too few, or you access an index that is one position off from what you intended.
- 10
Division by Zero
You divided by zero — the result is undefined mathematically and causes Infinity (JavaScript), ZeroDivisionError (Python), or a crash.
- 11
Stack Overflow
Your program made too many nested function calls — the call stack ran out of space and the program crashed.
- 12
Unexpected Token
The parser encountered a symbol or keyword where it did not belong — usually a missing bracket, comma, or semicolon.
- 13
Missing Return Statement
Your function calculated a value but forgot to return it — the caller receives undefined instead of the expected result.
- 14
Operator Precedence Error
Your expression gives the wrong result because operators are evaluated in an order you did not intend.
- 15
String Concatenation Instead of Addition
You used + with a string and a number, so JavaScript concatenated them (e.g., "10" + 5 = "105") instead of adding.
- 16
Floating-Point Precision Error
Your decimal calculation gives a result like 0.30000000000000004 instead of 0.3 — a fundamental limitation of floating-point math.
- 17
Case Sensitivity Error
You used Name instead of name (or vice versa) — most languages treat these as different identifiers.
- 18
Unreachable Code
You wrote code after a return or break statement — it can never run and is dead code.
- 19
Variable Shadowing
You declared a variable with the same name as one in an outer scope — the inner variable hides the outer one, causing confusion.
- 20
Incorrect Loop Boundary
Your loop starts at the wrong index or ends at the wrong condition, causing it to skip elements or process extra ones.
- 21
Null Pointer Dereference
You tried to read a property or call a method on null or undefined — the value has no properties to access.
- 22
Unexpected Type Coercion
JavaScript converted a value to a different type automatically, causing your code to behave differently than expected.
- 23
Missing Semicolon
You omitted a semicolon and JavaScript's automatic insertion guessed wrong, causing unexpected behavior.
- 24
Incorrect Array Method
You used the wrong array method — splice mutates while slice copies, forEach returns undefined while map returns a new array.
- 25
Unhandled Promise Rejection
A Promise was rejected (an async operation failed) but you did not handle the error — the rejection is lost.
- 26
Circular Reference
An object points to itself (directly or through a chain), causing JSON.stringify or traversal to fail or loop forever.
- 27
Integer Overflow
Your calculation exceeded the maximum value the number type can hold, producing an unexpected result.
- 28
Incorrect Comparison Operator
You used the wrong comparison operator, so a boundary value is included or excluded when it should not be.
- 29
Missing Break in Switch
You forgot a break in a switch case, so execution falls through to the next case and runs code you did not intend.
- 30
Memory Leak
Your program keeps allocating memory without releasing it — over time, memory usage grows until the program slows or crashes.
- 31
Invalid Regular Expression
You passed a malformed pattern to RegExp() — the engine rejects it with a SyntaxError before any matching can happen.
- 32
JSON Parse Failure on Malformed String
You passed a string that is not valid JSON to JSON.parse — even a single trailing comma or unquoted key makes it fail.
- 33
Invalid Date Construction
You passed a string the Date parser cannot understand — the result is an Invalid Date, and getTime() returns NaN.
- 34
Concurrent Map Modification During Iteration
You added or deleted entries while a for...of loop was reading the Map — the iterator sees the mutation and produces wrong results.
- 35
Async Callback Invoked Twice
Your function called the callback for both the success and error paths — the caller receives two completions and runs its logic twice.
- 36
Prototype Property Pollution
You merged untrusted data that contained a __proto__ key — now every plain object inherits the injected property, breaking comparisons and logic.
- 37
Symbol To String Coercion Error
You concatenated a Symbol with a string using + or templated it without String() — JavaScript throws because Symbols cannot coerce implicitly.
- 38
Missing Import Statement
You referenced a function or class that lives in another file but forgot the import statement — the name is undefined.
- 39
Unclosed Template Literal
You opened a template literal with ` but never closed it — the parser runs to the end of the file looking for the closing backtick.
- 40
Invalid Arrow Function Syntax
Your arrow function has malformed parameters or a body that does not parse — the compiler rejects the file.
- 41
Mismatched Curly Braces
You have more { than } (or vice versa) — the parser cannot determine where a block ends and reports a syntax error.
- 42
Invalid Destructuring Pattern
Your destructuring pattern expects a different shape than the source — variables end up undefined or the parser rejects the pattern.
- 43
Duplicate Catch Parameter Name
You used the same identifier for two parameters — strict mode forbids duplicate parameter names.
- 44
Wrong Reduce Initial Value
Your reduce starts from the wrong seed — the accumulator's first value is off, so every subsequent step compounds the error.
- 45
Timezone Offset Miscalculation
You combined getHours (local) with getUTCHours, or forgot the sign on getTimezoneOffset — the resulting time is off by hours.
- 46
Floating Point Accumulation Drift
Adding 0.1 many times does not give a clean multiple — tiny errors accumulate and the final sum drifts from the true value.
- 47
Pagination Boundary Mistake
Your slice start or end is off by one page size — the first or last item of a page is duplicated or dropped.
- 48
De Morgan's Law Misapplication
You negated !(a && b) as !a && !b instead of !a || !b — the condition fires on the wrong inputs.
- 49
Unicode String Slicing Error
You used .slice on a string with emoji or astral characters — the cut lands inside a surrogate pair and produces a broken character.
- 50
Silent Error Swallowed by Empty Catch
You wrote catch (e) {} with no logging or handling — failures vanish silently and bugs appear far from their source.
No errors found.