Jump to solution
Verify

The Fix

pip install fastapi==0.128.4

Based on closed fastapi/fastapi issue #14444 · 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
@@ -15,6 +15,19 @@ +def _unwrapped_call(call: Optional[Callable[..., Any]]) -> Any: + if call is None: + return call # pragma: no cover
repro.py
from functools import wraps import uvicorn from fastapi import FastAPI app = FastAPI() def my_decorator(func): """A decorator that wraps a sync function with an async handler.""" @wraps(func) async def wrapper(): func() return 'OK' return wrapper @app.get('/') @my_decorator def index(): """A simple sync page function.""" print('Hello!') if __name__ == '__main__': uvicorn.run(app)
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\npip install fastapi==0.128.4\nWhen NOT to use: This fix should not be used if the decorator does not wrap async functions correctly.\n\n

Why This Fix Works in Production

  • Trigger: ValueError: [TypeError("'coroutine' object is not iterable"), TypeError('vars() argument must have __dict__ attribute')]
  • Mechanism: Fixes support for functools wraps and partial combined for async and regular functions in FastAPI path operations and dependencies, addressing the issue where async wrappers around sync functions caused errors.
  • Why the fix works: Fixes support for functools wraps and partial combined for async and regular functions in FastAPI path operations and dependencies, addressing the issue where async wrappers around sync functions caused errors. (first fixed release: 0.128.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

  • Surfaces as: ValueError: [TypeError("'coroutine' object is not iterable"), TypeError('vars() argument must have __dict__ attribute')]

Proof / Evidence

Discussion

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

“This should be fixed by https://github.com/fastapi/fastapi/pull/14448 It's now released in FastAPI 0.123.6 :tada:”
@tiangolo · 2025-12-04 · confirmation · source

Failure Signature (Search String)

  • ValueError: [TypeError("'coroutine' object is not iterable"), TypeError('vars() argument must have __dict__ attribute')]

Error Message

Stack trace
error.txt
Error Message ------------- ValueError: [TypeError("'coroutine' object is not iterable"), TypeError('vars() argument must have __dict__ attribute')]

Minimal Reproduction

repro.py
from functools import wraps import uvicorn from fastapi import FastAPI app = FastAPI() def my_decorator(func): """A decorator that wraps a sync function with an async handler.""" @wraps(func) async def wrapper(): func() return 'OK' return wrapper @app.get('/') @my_decorator def index(): """A simple sync page function.""" print('Hello!') if __name__ == '__main__': uvicorn.run(app)

What Broke

Internal Server Error occurs when accessing the endpoint, leading to application downtime.

Fix Options (Details)

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

pip install fastapi==0.128.4

When NOT to use: This fix should not be used if the decorator does not wrap async functions correctly.

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

First fixed release: 0.128.4

Last verified: 2026-02-08. 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 used if the decorator does not wrap async functions correctly.

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