The Fix
pip install fastapi==0.128.4
Based on closed fastapi/fastapi issue #14466 · 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%.
@@ -110,6 +110,8 @@ def is_gen_callable(self) -> bool:
) or inspect.isgeneratorfunction(_unwrapped_call(self.call)):
return True
+ if inspect.isclass(_unwrapped_call(self.call)):
+ return False
dunder_call = getattr(_impartial(self.call), "__call__", None) # noqa: B004
from typing import Annotated
from fastapi import Depends, FastAPI
from fastapi.dependencies.models import Dependant
from uvicorn import run
class Dependency:
def __init__(self):
print("init")
async def __call__(self):
print("call")
print(Dependant(Dependency).is_coroutine_callable)
# `True` with fastapi>=0.123.6
# `False` with fastapi<0.123.6
app = FastAPI()
@app.get("/")
async def route(*, dependency: Annotated[Dependency, Depends()]):
await dependency()
run(app)
# then `curl localhost:8000`
Re-run the minimal reproduction on your broken version, then apply the fix and re-run.
Option A — Upgrade to fixed release\npip install fastapi==0.128.4\nWhen NOT to use: Do not use this fix if the dependency is not a class with a __call__ method.\n\n
Why This Fix Works in Production
- Trigger: solved = await call(**solved_result.values)
- Mechanism: FastAPI incorrectly identifies class dependencies with a __call__ method as coroutine callables
- Why the fix works: Fixed a regression in FastAPI 0.123.6 where class dependencies with a __call__ method were incorrectly identified as coroutine callables, causing a TypeError when awaited. (first fixed release: 0.128.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.14 in real deployments (not just unit tests).
- FastAPI incorrectly identifies class dependencies with a __call__ method as coroutine callables
- Surfaces as: File ".venv/lib/python3.14/site-packages/fastapi/dependencies/utils.py", line 647, in solve_dependencies
Proof / Evidence
- GitHub issue: #14466
- Fix PR: https://github.com/fastapi/fastapi/pull/14458
- First fixed release: 0.128.4
- Reproduced locally: No (not executed)
- Last verified: 2026-02-08
- Confidence: 0.95
- Did this fix it?: Yes (upstream fix exists)
- Own content ratio: 0.54
Discussion
High-signal excerpts from the issue thread (symptoms, repros, edge-cases).
“Fixed by https://github.com/fastapi/fastapi/pull/14458”
Failure Signature (Search String)
- solved = await call(**solved_result.values)
Error Message
Stack trace
Error Message
-------------
File ".venv/lib/python3.14/site-packages/fastapi/dependencies/utils.py", line 647, in solve_dependencies
solved = await call(**solved_result.values)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: 'Dependency' object can't be awaited
Minimal Reproduction
from typing import Annotated
from fastapi import Depends, FastAPI
from fastapi.dependencies.models import Dependant
from uvicorn import run
class Dependency:
def __init__(self):
print("init")
async def __call__(self):
print("call")
print(Dependant(Dependency).is_coroutine_callable)
# `True` with fastapi>=0.123.6
# `False` with fastapi<0.123.6
app = FastAPI()
@app.get("/")
async def route(*, dependency: Annotated[Dependency, Depends()]):
await dependency()
run(app)
# then `curl localhost:8000`
Environment
- Python: 3.14
What Broke
TypeError occurs when trying to await an instance of a class dependency in FastAPI routes.
Why It Broke
FastAPI incorrectly identifies class dependencies with a __call__ method as coroutine callables
Fix Options (Details)
Option A — Upgrade to fixed release Safe default (recommended)
pip install fastapi==0.128.4
Use when you can deploy the upstream fix. It is usually lower-risk than long-lived workarounds.
Fix reference: https://github.com/fastapi/fastapi/pull/14458
First fixed release: 0.128.4
Last verified: 2026-02-08. Validate in your environment.
When NOT to Use This Fix
- Do not use this fix if the dependency is not a class with a __call__ method.
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
- 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
| Version | Status |
|---|---|
| 0.128.4 | Fixed |
Related Issues
No related fixes found.
Sources
We don’t republish the full GitHub discussion text. Use the links above for context.