Jump to solution
Verify

The Fix

Upgrade to version 0.11.4 or later.

Based on closed Kludex/uvicorn issue #285 · 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
@@ -1,4 +1,4 @@ from uvicorn.main import main, run -__version__ = "0.3.29" +__version__ = "0.3.30" __all__ = ["main", "run"]
repro.py
$ uvicorn app:App --debug Traceback (most recent call last): File "/home/jamie.chang/.local/bin/uvicorn", line 11, in <module> sys.exit(main()) File "/home/jamie.chang/.local/lib/python3.5/site-packages/click/core.py", line 764, in __call__ return self.main(*args, **kwargs) File "/home/jamie.chang/.local/lib/python3.5/site-packages/click/core.py", line 717, in main rv = self.invoke(ctx) File "/home/jamie.chang/.local/lib/python3.5/site-packages/click/core.py", line 956, in invoke return ctx.invoke(self.callback, **ctx.params) File "/home/jamie.chang/.local/lib/python3.5/site-packages/click/core.py", line 555, in invoke return callback(*args, **kwargs) File "/home/jamie.chang/.local/lib/python3.5/site-packages/uvicorn/main.py", line 166, in main logger = get_logger(log_level) NameError: name 'get_logger' is not defined
verify
Re-run: uvicorn app:App --debug
fix.md
Option A — Upgrade to fixed release\nUpgrade to version 0.11.4 or later.\nWhen NOT to use: This fix should not be applied if the application does not require the 'get_logger' functionality.\n\n

Why This Fix Works in Production

  • Trigger: $ uvicorn app:App --debug
  • Mechanism: A missing import for 'get_logger' caused a NameError when running Uvicorn in debug mode
  • Why the fix works: Fixes a NameError by adding a missing import for 'get_logger'. (first fixed release: 0.11.4).
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.5 in real deployments (not just unit tests).
  • A missing import for 'get_logger' caused a NameError when running Uvicorn in debug mode
  • Surfaces as: $ uvicorn app:App --debug

Proof / Evidence

  • GitHub issue: #285
  • Fix PR: https://github.com/kludex/uvicorn/pull/286
  • First fixed release: 0.11.4
  • 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.37

Discussion

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

“Released as 0.3.30. Planning to work on bumping the test coverage up in order to avoid this kind of breakage in the future.”
@lovelydinosaur · 2019-01-22 · confirmation · source

Failure Signature (Search String)

  • $ uvicorn app:App --debug

Error Message

Stack trace
error.txt
Error Message ------------- $ uvicorn app:App --debug Traceback (most recent call last): File "/home/jamie.chang/.local/bin/uvicorn", line 11, in <module> sys.exit(main()) File "/home/jamie.chang/.local/lib/python3.5/site-packages/click/core.py", line 764, in __call__ return self.main(*args, **kwargs) File "/home/jamie.chang/.local/lib/python3.5/site-packages/click/core.py", line 717, in main rv = self.invoke(ctx) File "/home/jamie.chang/.local/lib/python3.5/site-packages/click/core.py", line 956, in invoke return ctx.invoke(self.callback, **ctx.params) File "/home/jamie.chang/.local/lib/python3.5/site-packages/click/core.py", line 555, in invoke return callback(*args, **kwargs) File "/home/jamie.chang/.local/lib/python3.5/site-packages/uvicorn/main.py", line 166, in main logger = get_logger(log_level) NameError: name 'get_logger' is not defined

Minimal Reproduction

repro.py
$ uvicorn app:App --debug Traceback (most recent call last): File "/home/jamie.chang/.local/bin/uvicorn", line 11, in <module> sys.exit(main()) File "/home/jamie.chang/.local/lib/python3.5/site-packages/click/core.py", line 764, in __call__ return self.main(*args, **kwargs) File "/home/jamie.chang/.local/lib/python3.5/site-packages/click/core.py", line 717, in main rv = self.invoke(ctx) File "/home/jamie.chang/.local/lib/python3.5/site-packages/click/core.py", line 956, in invoke return ctx.invoke(self.callback, **ctx.params) File "/home/jamie.chang/.local/lib/python3.5/site-packages/click/core.py", line 555, in invoke return callback(*args, **kwargs) File "/home/jamie.chang/.local/lib/python3.5/site-packages/uvicorn/main.py", line 166, in main logger = get_logger(log_level) NameError: name 'get_logger' is not defined

Environment

  • Python: 3.5

What Broke

Running Uvicorn in debug mode resulted in a NameError, preventing the application from starting.

Why It Broke

A missing import for 'get_logger' caused a NameError when running Uvicorn in debug mode

Fix Options (Details)

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

Upgrade to version 0.11.4 or later.

When NOT to use: This fix should not be applied if the application does not require the 'get_logger' functionality.

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/286

First fixed release: 0.11.4

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

  • This fix should not be applied if the application does not require the 'get_logger' functionality.

Verify Fix

verify
Re-run: uvicorn app:App --debug

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.11.4 Fixed

Related Issues

No related fixes found.

Sources

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