40 errors · 207 ranked causes
Fix an Error
The forty error messages developers hit most often, one page each. Every page opens with what the message actually means, shows the console output so you can confirm you are in the right place, then lists the causes in the order they are usually to blame — with the fix attached to each one rather than a list of things to try.
Nothing here suggests a destructive command as a first resort, and where a fix carries real risk the page says so in the same breath. Use Ctrl-F to find your message, or pick an ecosystem below.
Node.js
Module resolution, ports, file paths and memory — the errors that stop a server before it serves anything.
- ERR_MODULE_NOT_FOUND5 causesNode's ES module loader followed an import to a file path that does not exist on disk.
- ERR_REQUIRE_ESM4 causesA CommonJS file called require() on a package that ships only as an ES module.
- Cannot find module5 causesThe CommonJS loader could not resolve a require() — either the package is not installed or the relative path is wrong.
- EADDRINUSE5 causesSomething else is already listening on the port your server is trying to bind.
- ECONNREFUSED5 causesThe connection reached the host and was actively refused — nothing is listening on that port.
- ENOENT: no such file or directory5 causesNode asked the operating system for a path that does not exist — usually resolved from a different working directory than you expected.
- JavaScript heap out of memory5 causesV8 reached its heap ceiling and could not free enough memory to continue, so the process aborted.
npm
Install failures, and why the obvious workaround for each is the wrong one.
- npm EACCES: permission denied4 causesnpm tried to write into a directory your user does not own — almost always a global install into a system-owned Node.
- npm ERESOLVE peer dependency conflict5 causesnpm refuses to install because two packages demand incompatible versions of the same peer dependency.
Python
Indentation, imports, None and the conversions that fail on real-world data.
- ModuleNotFoundError: No module named5 causesThe interpreter that ran your code cannot see that package on its import path.
- IndentationError: unexpected indent4 causesA line is indented further than the line before it without anything having opened a new block.
- IndentationError: expected an indented block5 causesA statement that opens a block — if, for, while, def, class, try — has nothing indented underneath it.
- TypeError: 'NoneType' object is not subscriptable4 causesYou indexed into something that is None — a call returned nothing where you expected a value.
- ValueError: invalid literal for int()5 causesint() was handed a string that is not a whole number written in base 10.
- UnicodeDecodeError: 'utf-8' codec can't decode byte5 causesPython tried to decode bytes as UTF-8 and hit a sequence that is not valid UTF-8.
- ImportError: circular import5 causesTwo modules import each other, so one is still half-executed when the other tries to read a name from it.
Git
Pushes that are refused, merges that stop, and the states that look like lost work but are not.
- rejected: non-fast-forward4 causesThe remote branch has commits you do not have locally, so your push would erase them.
- Merge conflict5 causesBoth branches changed the same lines, so Git stopped and left both versions in the file for you to decide between.
- fatal: refusing to merge unrelated histories4 causesThe two branches share no common ancestor, so Git will not merge them unless you say explicitly that you mean to.
- src refspec main does not match any5 causesYou asked Git to push a branch name that does not exist locally — usually because the repository has no commits yet.
- Permission denied (publickey)5 causesThe SSH server rejected every key your client offered, so it never authenticated you.
- detached HEAD5 causesHEAD points straight at a commit rather than at a branch, so new commits belong to no branch and are easy to lose track of.
- fatal: not a git repository5 causesThe directory you ran the command in — and none of its parents — contains a Git repository.
Browser and JavaScript
What the console says when a page breaks, and what it usually means underneath.
- Blocked by CORS policy6 causesThe browser blocked your JavaScript from reading a cross-origin response because the server never said your origin is allowed to.
- Cannot read properties of undefined6 causesYou read a property from a value that is undefined — the object you expected was never assigned.
- is not a function6 causesYou called a method on a value that is not the type you assumed — usually not an array, or undefined.
- Uncaught SyntaxError: Unexpected token5 causesThe browser tried to parse something that is not valid JavaScript — most often an HTML error page served where a script or JSON was expected.
- Hydration failed6 causesReact's client render produced different markup than the server sent, so it discarded the server HTML and re-rendered from scratch.
- Maximum call stack size exceeded6 causesThe call stack grew past the engine's limit — nearly always unbounded recursion.
TypeScript
The four compiler errors that account for most of a strict-mode migration.
- TS2307: Cannot find module6 causesTypeScript could not resolve the import to a module, or found the module but no type declarations for it.
- TS2345: Argument is not assignable6 causesThe value you passed has a type the function does not accept.
- TS7006: Parameter implicitly has an 'any' type5 causesWith noImplicitAny enabled, TypeScript needs an annotation for a parameter whose type it cannot infer.
- TS2532: Object is possibly 'undefined'6 causesUnder strictNullChecks the value's type includes undefined, and you used it without ruling that out.
Docker
Ports, disk and permissions — where the fix is often on the host, not in the image.
- port is already allocated5 causesDocker cannot publish the host port you asked for because something already holds it.
- no space left on device6 causesThe filesystem holding Docker's data — or the virtual disk on Docker Desktop — is full.
- permission denied: /var/run/docker.sock5 causesYour user is not allowed to talk to the Docker daemon's socket.
HTTP status codes
The four responses that send people looking for an explanation, including the two pairs that are constantly confused.
- 401 Unauthorized6 causesThe request carried no valid authentication, so the server does not yet know who you are.
- 403 Forbidden6 causesThe server knows who you are and is refusing anyway — this is about permission, not identity.
- 502 Bad Gateway6 causesA proxy in front of your application received an invalid or empty response from it.
- 504 Gateway Timeout6 causesThe proxy waited for your application and gave up before a response arrived.
Somewhere to reproduce it
Isolating a failure in a scratch file is usually quicker than debugging it in place. AltF Code is a free browser-based editor built on the engine behind Visual Studio Code, with real highlighting for HTML, CSS, JavaScript, TypeScript, JSON, Markdown, Python and SQL, and live execution for HTML, CSS and JavaScript.
About this set
- How do I find my error here?
- Search this page with Ctrl-F (Cmd-F on a Mac) for the distinctive part of the message — the error code, or four or five unusual words. Every page shows the exact console output as well, so you can confirm you are looking at the right one before you change anything.
- Are the fixes safe to run as written?
- They are written to be. No page offers a destructive command as its first suggestion: there is no rm -rf, no chmod 777, no force push at a shared branch, and sudo npm install -g is named as the wrong answer for EACCES rather than the fix. Where an action genuinely carries risk — ignoring peer dependency ranges, pruning Docker volumes, joining the docker group — the page says so in the same sentence that suggests it.
- Why are the causes numbered?
- Because order is most of the value. The causes on each page are ranked by how often they are actually the problem, so working from the top down finds the answer faster than reading everything. The first cause is right far more often than the last.
- My error message is slightly different. Is the page still relevant?
- Usually yes. Error text changes between versions — line numbers move, wording is tightened, some runtimes add a hint line — while the underlying cause stays the same. Match on the error code or the distinctive phrase rather than on the whole string.