python
system_error
ai_generated
true
OSError: [Errno 98] Address already in use
ID: python/starlette-uvicorn-port-in-use
80%Fix Rate
88%Confidence
0Evidence
2024-01-09First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 3.x | active | — | — | — |
Root Cause
Another process (often a previous uvicorn run) is already bound to the target port.
generic中文
另一个进程(通常是之前的 uvicorn 运行)已绑定到目标端口。
Workarounds
-
95% success
lsof -i :8000 | awk 'NR>1 {print $2}' | xargs kill -9 -
92% success
uvicorn app:app --port 8001
Dead Ends
Common approaches that don't work:
-
85% fail
The old process keeps the port bound.
-
90% fail
Reload does not free the port; the parent still binds it.