Jump to solution
Verify

The Fix

pip install fastapi==0.128.5

Based on closed fastapi/fastapi issue #10787 · 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
@@ -49,6 +49,8 @@ "msg": {"title": "Message", "type": "string"}, "type": {"title": "Error Type", "type": "string"}, + "input": {"title": "Input"}, + "ctx": {"title": "Context", "type": "object"}, },
repro.py
validation_error_definition = { "title": "ValidationError", "type": "object", "properties": { "loc": { "title": "Location", "type": "array", "items": {"anyOf": [{"type": "string"}, {"type": "integer"}]}, }, "input": {"title": "Input", "type": "any"}, "url": {"title": "URL", "type": "string"}, "msg": {"title": "Message", "type": "string"}, "type": {"title": "Error Type", "type": "string"}, }, "required": ["loc", "msg", "type"], }
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.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: Old `HTTPValidationError` and `ValidationError` OpenAPI entry
  • Mechanism: The OpenAPI `ValidationError` schema was outdated and did not reflect the actual error format returned by Pydantic V2
  • Why the fix works: Updated the `ValidationError` schema to include `input` and `ctx` fields, reflecting the actual error format returned by Pydantic V2. (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

  • Dependency interaction matters here: Pydantic v2.
  • The OpenAPI `ValidationError` schema was outdated and did not reflect the actual error format returned by Pydantic V2
  • Surfaces as: Old `HTTPValidationError` and `ValidationError` OpenAPI entry

Proof / Evidence

Verified Execution

We executed the runnable minimal repro in a temporary environment and captured exit codes + logs.

  • Status: PASS
  • Ran: 2026-02-11T16:52:29Z
  • Package: fastapi
  • Fixed: 0.128.5
  • Mode: fixed_only
  • Outcome: ok
Logs
affected (exit=None)
fixed (exit=0)

Discussion

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

“This should be solved by https://github.com/fastapi/fastapi/pull/14791, in FastAPI 0.128.1, released in the next few hours. ☕”
@tiangolo · 2026-02-04 · confirmation · source
“It would be cool to have an API to modify the RequestValidationError OpenAPI entry, and not only the exception_handler.”
@Kludex · 2023-12-16 · source
“This is what we need right? But this change would require changing a lot of tests.”
@iudeen · 2023-12-18 · source
“validation_error_response_definition seems to be correct at the moment, but validation_error_response_definition should be updated by adding the absent input and ctx fields”
@YuriiMotov · 2025-07-28 · source

Failure Signature (Search String)

  • Old `HTTPValidationError` and `ValidationError` OpenAPI entry

Error Message

Stack trace
error.txt
Error Message ------------- Old `HTTPValidationError` and `ValidationError` OpenAPI entry

Minimal Reproduction

repro.py
validation_error_definition = { "title": "ValidationError", "type": "object", "properties": { "loc": { "title": "Location", "type": "array", "items": {"anyOf": [{"type": "string"}, {"type": "integer"}]}, }, "input": {"title": "Input", "type": "any"}, "url": {"title": "URL", "type": "string"}, "msg": {"title": "Message", "type": "string"}, "type": {"title": "Error Type", "type": "string"}, }, "required": ["loc", "msg", "type"], }

Environment

  • Pydantic: 2

What Broke

The OpenAPI documentation incorrectly represented validation errors, leading to confusion and integration issues.

Why It Broke

The OpenAPI `ValidationError` schema was outdated and did not reflect the actual error format returned by Pydantic V2

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

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.

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

Related Issues

No related fixes found.

Sources

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