Founding prices until 15 December: 30% off Pro, locked for life. See pricing

$ … bind: address already in use

'Address already in use': find what's holding the port

Another process (often an old copy of the same one) already listens on that port.

Networking

What it means

Only one socket can listen on an address and port (EADDRINUSE). The usual holder is an older instance of the same service, another service with the same default port, or a container publishing it.

Causes and fixes

Most likely first. Run the check, and if it matches, apply the fix.

1. Another process listens on the port

Check:

ss -ltnp 'sport = :8080'
lsof -i :8080

Fix: Stop that process (systemctl stop, kill <pid>), or configure your service on another port.

2. Docker publishes the port for a container

Check:

docker ps --format '{{.Names}} {{.Ports}}' | grep 8080

Fix: Stop the container or change its published port.

3. The same program started twice (a stale instance, a supervisor plus a manual start)

Check:

pgrep -af <name>

Fix: Run it under one supervisor only.

Fix it yourself

A live machine in your browser with this problem already on it. The grader checks the result.

Open the lab

No account needed for your first tries.

Related errors