Go: listen tcp :8080: bind: address already in use
The port your Go server wants is already taken by another process (or a previous instance of your app).
listen tcp :8080: bind: address already in uselisten tcp 0.0.0.0:8080: bind: address already in usebind: address already in use golisten tcp 127.0.0.1:3000: bind: address already in use Meaning
Find the process with lsof -i :8080 or ss -ltnp, stop it, or choose another port (read from PORT). A crashed dev server or go run child process can stay alive. In containers ensure only one process binds the port.
Common causes
- Previous instance still running
- Another service on the same port
- go run left a child process
- Port published twice in Docker
- Hot-reload tool starting two copies
⚡ Quick fix
lsof -i :8080thenkill <pid>- Use a different port via env
PORT - Check Docker/compose port mappings
Detailed fix by platform
Linux
ss -ltnp | grep :8080orlsof -i :8080
How to diagnose
- Owner — Which PID?
- Port — Configurable?
- Docker — Duplicate mapping?
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
- assignment mismatch: 1 variable but f returns 2 values Go: assignment mismatch: 1 variable but os.Open returns 2 values
- cannot assign to struct field m[k].f in map Go: cannot assign to struct field users["bob"].Age in map
- cannot find package in any of GOROOT / GOPATH Go: cannot find package "github.com/pkg/errors" in any of: /usr/local/go/src/github.com/pkg/errors (from $GOROOT) /go/src/github.com/pkg/errors (from $GOPATH)
Most viewed in Go
Other ways to find it
Where this error sits
Origin: Application & API. Errors that are often confused with or caused by this one (click to open):
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
💬 What worked for others
No tips yet — did something else fix this for you?
Share what worked for you
Tips are checked by an editor before they appear. Links are removed.
Report a correction or suggest an improvement
Last updated 4 Nov 2026