The Fix
Upgrade to version 0.11.4 or later.
Based on closed Kludex/uvicorn issue #374 · 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%.
@@ -141,10 +141,14 @@ def __init__(
self.loaded = False
+ @property
+ def is_ssl(self) -> bool:
+ return self.ssl_keyfile or self.ssl_certfile
docker run -it -p 8000:8000 ubuntu bash
apt update
apt install --yes python3 python3-dev python3-pip neovim
pip3 install uvicorn
nvim example.py # paste in the example code from README.md
export LC_ALL=C.UTF-8 # fix system encoding -- this is not required if you run this in a proper VM or on bare metal
export LANG=C.UTF-8
uvicorn example:app # this works -- visit 127.0.0.1:8000
uvicorn example:app --reload # this causes an error, see below
Re-run the minimal reproduction on your broken version, then apply the fix and re-run.
Option A — Upgrade to fixed release\nUpgrade to version 0.11.4 or later.\nWhen NOT to use: This fix should not be used if SSL context is not properly configured.\n\n
Why This Fix Works in Production
- Trigger: root@4a74f603e723:/# uvicorn example:app --reload
- Mechanism: The Config class did not initialize the ssl attribute, causing an AttributeError when using the --reload flag
- Why the fix works: Added a property to the Config class to check for SSL context, resolving the AttributeError when using the --reload flag. (first fixed release: 0.11.4).
- 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.6 in real deployments (not just unit tests).
- The Config class did not initialize the ssl attribute, causing an AttributeError when using the --reload flag
- Surfaces as: root@4a74f603e723:/# uvicorn example:app --reload
Proof / Evidence
- GitHub issue: #374
- Fix PR: https://github.com/encode/uvicorn/pull/375
- First fixed release: 0.11.4
- Reproduced locally: No (not executed)
- Last verified: 2026-02-09
- Confidence: 0.75
- Did this fix it?: Yes (upstream fix exists)
- Own content ratio: 0.28
Discussion
High-signal excerpts from the issue thread (symptoms, repros, edge-cases).
“Same issue here”
“+1 Just started happening. Issue does not exist in 0.7.2 both --reload and --debug flags are affected.”
“Meh. What's our options here - do we just have to revert #362 / #352?”
“Does Config.bind_socket need an actual SSL context, or just a check equivalent to the one being made in Config.load? i.e”
Failure Signature (Search String)
- root@4a74f603e723:/# uvicorn example:app --reload
Error Message
Stack trace
Error Message
-------------
root@4a74f603e723:/# uvicorn example:app --reload
Traceback (most recent call last):
File "/usr/local/bin/uvicorn", line 11, in <module>
sys.exit(main())
File "/usr/local/lib/python3.6/dist-packages/click/core.py", line 764, in __call__
return self.main(*args, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/click/core.py", line 717, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python3.6/dist-packages/click/core.py", line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python3.6/dist-packages/click/core.py", line 555, in invoke
return callback(*args, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/uvicorn/main.py", line 257, in main
run(**kwargs)
File "/usr/local/lib/python3.6/dist-packages/uvicorn/main.py", line 270, in run
socket = config.bind_socket()
File "/usr/local/lib/python3.6/dist-packages/uvicorn/config.py", line 222, in bind_socket
protocol_name = "https" if self.ssl else "http"
AttributeError: 'Config' object has no attribute 'ssl'
Stack trace
Error Message
-------------
Traceback (most recent call last):
File "/home/kthwaite/.virtualenvs/test/bin/uvicorn", line 10, in <module>
sys.exit(main())
File "/home/kthwaite/.virtualenvs/test/local/lib/python3.6/dist-packages/click/core.py", line 764, in __call__
return self.main(*args, **kwargs)
File "/home/kthwaite/.virtualenvs/test/local/lib/python3.6/dist-packages/click/core.py", line 717, in main
rv = self.invoke(ctx)
File "/home/kthwaite/.virtualenvs/test/local/lib/python3.6/dist-packages/click/core.py", line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/home/kthwaite/.virtualenvs/test/local/lib/python3.6/dist-packages/click/core.py", line 555, in invoke
return callback(*args, **kwargs)
File "/home/kthwaite/.virtualenvs/test/local/lib/python3.6/dist-packages/uvicorn/main.py", line 257, in main
run(**kwargs)
File "/home/kthwaite/.virtualenvs/test/local/lib/python3.6/dist-packages/uvicorn/main.py", line 274, in run
socket = config.bind_socket()
File "/home/kthwaite/.virtualenvs/test/local/lib/python3.6/dist-packages/uvicorn/config.py", line 222, in bind_socket
protocol_name = "https" if self.ssl else "http"
AttributeError: 'Config' object has no attribute 'ssl'
Minimal Reproduction
docker run -it -p 8000:8000 ubuntu bash
apt update
apt install --yes python3 python3-dev python3-pip neovim
pip3 install uvicorn
nvim example.py # paste in the example code from README.md
export LC_ALL=C.UTF-8 # fix system encoding -- this is not required if you run this in a proper VM or on bare metal
export LANG=C.UTF-8
uvicorn example:app # this works -- visit 127.0.0.1:8000
uvicorn example:app --reload # this causes an error, see below
Environment
- Python: 3.6
What Broke
Uvicorn fails to start with an AttributeError when using the --reload flag.
Why It Broke
The Config class did not initialize the ssl attribute, causing an AttributeError when using the --reload flag
Fix Options (Details)
Option A — Upgrade to fixed release Safe default (recommended)
Upgrade to version 0.11.4 or later.
Use when you can deploy the upstream fix. It is usually lower-risk than long-lived workarounds.
Fix reference: https://github.com/encode/uvicorn/pull/375
First fixed release: 0.11.4
Last verified: 2026-02-09. Validate in your environment.
When NOT to Use This Fix
- This fix should not be used if SSL context is not properly configured.
Verify Fix
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
- Add a TLS smoke test that performs a real handshake in CI (include CA bundle validation and hostname checks).
- Alert on handshake failures by error string and endpoint to catch cert/CA changes quickly.
Version Compatibility Table
| Version | Status |
|---|---|
| 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.