LogLens AI / Errors / Address already in use (EADDRINUSE)

Address already in use (EADDRINUSE): how to fix it

TL;DR. 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)

  1. Find the process on the port. lsof -i :3000 or ss -ltnp 'sport = :3000' shows the PID.
  2. 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.
  3. 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.

Install LogLensSee the tour

Related errors

FAQ

How do I find what is using a port?

Run lsof -i : or ss -ltnp | grep : — both show the PID and command currently bound to that port.

How do I kill the process using a port?

Get its PID from lsof -i :, then run kill (or kill -9 if it won't stop), or just start your app on a different port.