Jump to solution
Verify

The Fix

Upgrade to version 0.12.3 or later.

Based on closed Kludex/uvicorn issue #825 · PR/commit linked

Production note: Most teams hit this during upgrades or environment changes. Roll out with a canary and smoke critical endpoints (health, OpenAPI/docs) before 100%.

Jump to Verify Open PR/Commit
@@ -33,6 +33,31 @@ def install_signal_handlers(self): +def test_run_hostname(): + class App: + def __init__(self, scope):
repro.py
import uvicorn async def app(scope, receive, send): assert scope['type'] == 'http' await send({ 'type': 'http.response.start', 'status': 200, 'headers': [ [b'content-type', b'text/plain'], ], }) await send({ 'type': 'http.response.body', 'body': b'Hello, world!', }) uvicorn.run(app, host='localhost', port=8083)
verify
Re-run the minimal reproduction on your broken version, then apply the fix and re-run.
fix.md
Option A — Upgrade to fixed release\nUpgrade to version 0.12.3 or later.\nWhen NOT to use: Do not use this fix if you require support for IPv6 addresses without explicit handling.\n\n

Why This Fix Works in Production

  • Trigger: return _run_code(code, main_globals, None,
  • Mechanism: Uvicorn fails to resolve host names due to improper handling of IP addresses in the code
  • Why the fix works: Fixes an issue where Uvicorn fails to resolve host names when using uvicorn.run with explicit hostnames. (first fixed release: 0.12.3).
Production impact:
  • If left unfixed, the same config can fail only in production (env differences), causing startup failures or partial feature outages.

Why This Breaks in Prod

  • Shows up under Python 3.8 in real deployments (not just unit tests).
  • Uvicorn fails to resolve host names due to improper handling of IP addresses in the code
  • Surfaces as: .py thon/debugpy/launcher 61232 -- /Users/paulafernandez/Sandbox/test/test/start

Proof / Evidence

  • GitHub issue: #825
  • Fix PR: https://github.com/kludex/uvicorn/pull/827
  • First fixed release: 0.12.3
  • Reproduced locally: No (not executed)
  • Last verified: 2026-02-09
  • Confidence: 0.85
  • Did this fix it?: Yes (upstream fix exists)
  • Own content ratio: 0.38

Discussion

High-signal excerpts from the issue thread (symptoms, repros, edge-cases).

“### Checklist <!-- Please make sure you check all these items before submitting your bug report. --> - [x] The bug is reproducible against the latest release and/or master. - [x] There are no similar issues or pull requests to fix it yet. #”
Issue thread · issue description · source

Failure Signature (Search String)

  • return _run_code(code, main_globals, None,

Error Message

Stack trace
error.txt
Error Message ------------- .py thon/debugpy/launcher 61232 -- /Users/paulafernandez/Sandbox/test/test/start INFO: Started server process [43171] INFO: Waiting for application startup. INFO: ASGI 'lifespan' protocol appears unsupported. INFO: Application startup complete. Traceback (most recent call last): File "/usr/local/Cellar/[email protected]/3.8.5/Frameworks/Python.framework/Versions/3.8/lib/python3.8/runpy.py", line 194, in _run_module_as_main return _run_code(code, main_globals, None, File "/usr/local/Cellar/[email protected]/3.8.5/Frameworks/Python.framework/Versions/3.8/lib/python3.8/runpy.py", line 87, in _run_code exec(code, run_globals) File "/Users/paulafernandez/.vscode/extensions/ms-python.python-2020.9.114305/pythonFiles/lib/python/debugpy/__main__.py", line 45, in <module> cli.main() File "/Users/paulafernandez/.vscode/extensions/ms-python.python-2020.9.114305/pythonFiles/lib/python/debugpy/../debugpy/server/cli.py", line 430, in main run() File "/Users/paulafernandez/.vscode/extensions/ms-python.python-2020.9.114305/pythonFiles/lib/python/debugpy/../debugpy/server/cli.py", line 267, in run_file runpy.run_path(options.target, run_name=compat.force_str("__main__")) File "/usr/local/Cellar/[email protected]/3.8.5/Frameworks/Python.framework/Versions/3.8/lib/python3.8/runpy.py", line 265, in run_path return _run_module_code(code, init_globals, run_name, Fil ... (truncated) ...

Minimal Reproduction

repro.py
import uvicorn async def app(scope, receive, send): assert scope['type'] == 'http' await send({ 'type': 'http.response.start', 'status': 200, 'headers': [ [b'content-type', b'text/plain'], ], }) await send({ 'type': 'http.response.body', 'body': b'Hello, world!', }) uvicorn.run(app, host='localhost', port=8083)

Environment

  • Python: 3.8

What Broke

Uvicorn throws an error when attempting to start with host names, causing application startup failures.

Why It Broke

Uvicorn fails to resolve host names due to improper handling of IP addresses in the code

Fix Options (Details)

Option A — Upgrade to fixed release Safe default (recommended)

Upgrade to version 0.12.3 or later.

When NOT to use: Do not use this fix if you require support for IPv6 addresses without explicit handling.

Use when you can deploy the upstream fix. It is usually lower-risk than long-lived workarounds.

Fix reference: https://github.com/kludex/uvicorn/pull/827

First fixed release: 0.12.3

Last verified: 2026-02-09. Validate in your environment.

Get updates

We publish verified fixes weekly. No spam.

Subscribe

When NOT to Use This Fix

  • Do not use this fix if you require support for IPv6 addresses without explicit handling.

Verify Fix

verify
Re-run the minimal reproduction on your broken version, then apply the fix and re-run.

Did This Fix Work in Your Case?

Quick signal helps us prioritize which fixes to verify and improve.

Prevention

  • Capture the exact failing error string in logs and tests so you can reproduce via a minimal script.
  • Pin production dependencies and upgrade only with a reproducible test that hits the failing path.

Version Compatibility Table

VersionStatus
0.12.3 Fixed

Related Issues

No related fixes found.

Sources

We don’t republish the full GitHub discussion text. Use the links above for context.