Address already in use (EADDRINUSE): how to fix it
EADDRINUSE ("address already in use") means another process is already listening on the port your app is trying to bind. Either that process is still running, a previous instance didn't exit cleanly, or two services share a port.What causes Address already in use (EADDRINUSE)
A previous instance of the app is still running; another service uses the same port; a crashed process left the socket in TIME_WAIT; or a dev reload started a second copy.
How to diagnose it
Find what owns the port: ss -ltnp | grep :<port> or lsof -i :<port> (macOS/Linux). That gives the PID and command holding it.
How to fix Address already in use (EADDRINUSE)
- Find the process on the port.
lsof -i :3000orss -ltnp 'sport = :3000'shows the PID. - Stop it or change your port. Kill the stale process (
kill <pid>) if it's an old instance, or configure your app to use a free port. - Enable address reuse for restarts. Set
SO_REUSEADDR(most frameworks do by default) so quick restarts don't hit TIME_WAIT sockets.
Example log line
Error: listen EADDRINUSE: address already in use :::3000
at Server.setupListenHandle [as _listen2] (node:net:1817:16)
How LogLens detects Address already in use (EADDRINUSE)
LogLens flags EADDRINUSE at startup and the restart loop it causes, so a stuck port is obvious. LogLens AI is a free, self-hosted AI log analyzer that surfaces lines like this automatically, groups them into one incident, and explains them in plain language.
Related errors
FAQ
How do I find what is using a port?
Run lsof -i :
How do I kill the process using a port?
Get its PID from lsof -i :