OSError: [Errno 98] Address already in use
The port your server wants to bind is already taken by another process.
Seen on:
Python
Meaning
Flask/Django/uvicorn dev servers left running, a previous crash, or another service on the same port. On macOS AirPlay Receiver uses port 5000.
Common causes
- Old server process still running
- Another service on the port (macOS AirPlay on 5000)
- Socket in TIME_WAIT after a restart
⚡ Quick fix
- Find and stop the process: lsof -i :8000
- Use another port
- Set SO_REUSEADDR for your own socket servers
Detailed fix by platform
Python
flask run --port 5001/uvicorn app:app --port 8001
How to diagnose
- Port — Which port?
- Owner — lsof -i :PORT
🧠 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.
Was this page helpful?
Report a correction or suggest an improvement
Last updated 2 Oct 2026