python
system_error
ai_generated
true
OSError: [Errno 98] Address already in use
ID: python/starlette-uvicorn-address-already-in-use
80%Fix Rate
90%Confidence
0Evidence
2024-01-15First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 0.30+ | active | — | — | — |
Root Cause
A previous server process is still bound to the port (e.g., uvicorn --reload left a zombie, or another app holds 8000).
generic中文
之前的服务器进程仍占用该端口(如 uvicorn --reload 遗留僵尸进程,或其他应用占用 8000)。
Workarounds
-
97% success
lsof -i :8000 | awk 'NR>1{print $2}' | xargs kill -9 # Windows: netstat -ano | findstr :8000 -
95% success
uvicorn main:app --port 8001
Dead Ends
Common approaches that don't work:
-
60% fail
Zombie process survives terminal close.
-
90% fail
uvicorn already sets it; a live listener still blocks.