Jump to solution
Details

The Fix

pip install fastapi==0.128.5

Based on closed fastapi/fastapi issue #9566 · 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%.

Open PR/Commit
@@ -42,7 +42,7 @@ classifiers = [ dependencies = [ "starlette>=0.27.0,<0.28.0", - "pydantic >=1.6.2,!=1.7,!=1.7.1,!=1.7.2,!=1.7.3,!=1.8,!=1.8.1,<2.0.0", + "pydantic>=1.7.4,!=1.8,!=1.8.1,<2.0.0", ]
fix.md
Option A — Upgrade to fixed release\npip install fastapi==0.128.5\nWhen NOT to use: Do not use if it changes public behavior or if the failure cannot be reproduced.\n\n

Why This Fix Works in Production

  • Trigger: from pydantic.typing import evaluate_forwardref, get_args, get_origin
  • Mechanism: The version of Pydantic specified does not include the 'get_args' function
  • Why the fix works: Updated the minimum version of Pydantic to >=1.7.4 to resolve the import error for 'get_args'. (first fixed release: 0.128.5).
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).
  • The version of Pydantic specified does not include the 'get_args' function
  • Surfaces as: from pydantic.typing import evaluate_forwardref, get_args, get_origin

Proof / Evidence

  • GitHub issue: #9566
  • Fix PR: https://github.com/fastapi/fastapi/pull/9567
  • First fixed release: 0.128.5
  • Reproduced locally: No (not executed)
  • Last verified: 2026-02-09
  • Confidence: 0.95
  • Did this fix it?: Yes (upstream fix exists)
  • Own content ratio: 0.66

Discussion

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

“Thanks a lot for the investigation here! :bow:”
@tiangolo · 2023-06-08 · source

Failure Signature (Search String)

  • from pydantic.typing import evaluate_forwardref, get_args, get_origin

Error Message

Stack trace
error.txt
Error Message ------------- from pydantic.typing import evaluate_forwardref, get_args, get_origin ImportError: cannot import name 'get_args' from 'pydantic.typing' (/Users/yfeng/Library/Caches/pypoetry/virtualenvs/aips-cq-resource-api-F3u0rVOe-py3.8/lib/python3.8/site-packages/pydantic/typing.cpython-38-darwin.so)

Environment

  • Python: 3.8

What Broke

ImportError occurs when trying to use 'get_args' from Pydantic.

Why It Broke

The version of Pydantic specified does not include the 'get_args' function

Fix Options (Details)

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

pip install fastapi==0.128.5

When NOT to use: Do not use if it changes public behavior or if the failure cannot be reproduced.

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

First fixed release: 0.128.5

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 if it changes public behavior or if the failure cannot be reproduced.

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

Related Issues

No related fixes found.

Sources

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