python
system_error
ai_generated
true
OSError: [Errno 98] Address already in use
ID: python/starlette-uvicorn-address-in-use
80%Fix Rate
89%Confidence
0Evidence
2024-02-22First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 3.x | active | — | — | — |
Root Cause
Another process (often a previous uvicorn reloader) is already bound to the host/port.
generic中文
另一个进程(通常是之前的 uvicorn 重载进程)已占用该主机/端口。
Workarounds
-
92% success
Find and kill the holder: lsof -i :8000 kill -9 <PID>
-
90% success
Run on a different port: uvicorn app:app --port 8001
Dead Ends
Common approaches that don't work:
-
85% fail
Reload doesn't free the port; it spawns another process that fails to bind.
-
90% fail
More workers compete for the same port and worsen the conflict.