node
debugging
ai_generated
true
Error: Starting inspector on 127.0.0.1:9229 failed: address already in use
ID: node/node-inspector-already-active
92%Fix Rate
94%Confidence
50Evidence
2023-01-01First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 20 | active | — | — | — |
Root Cause
The Node.js inspector (debugger) port 9229 is already in use by another Node.js process or a previous debug session that was not properly terminated.
genericWorkarounds
-
95% success Use a different inspector port: --inspect=9230
node --inspect=127.0.0.1:9230 app.js — each debug session should use a unique port
Sources: https://nodejs.org/en/docs/guides/debugging-getting-started
-
90% success Find and kill the process using port 9229
lsof -i :9229 to find the PID, then kill <PID>
Sources: https://nodejs.org/api/debugger.html
Dead Ends
Common approaches that don't work:
-
Running multiple --inspect processes without specifying different ports
90% fail
All default to port 9229; only the first one succeeds, the rest fail with this error
-
Killing all Node.js processes to free the port
60% fail
Kills production processes along with debug ones; overly destructive approach
Error Chain
Leads to:
Preceded by:
Frequently confused with: