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%.
@@ -49,6 +49,8 @@
"msg": {"title": "Message", "type": "string"},
"type": {"title": "Error Type", "type": "string"},
+ "input": {"title": "Input"},
+ "ctx": {"title": "Context", "type": "object"},
},
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"],
}
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.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).
- 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
- GitHub issue: #10787
- Fix PR: https://github.com/fastapi/fastapi/pull/14791
- First fixed release: 0.128.5
- Reproduced locally: No (not executed)
- Last verified: 2026-02-09
- Confidence: 0.85
- Did this fix it?: Yes (upstream fix exists)
- Own content ratio: 0.60
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
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. ☕”
“It would be cool to have an API to modify the RequestValidationError OpenAPI entry, and not only the exception_handler.”
“This is what we need right? But this change would require changing a lot of tests.”
“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”
Failure Signature (Search String)
- Old `HTTPValidationError` and `ValidationError` OpenAPI entry
Error Message
Stack trace
Error Message
-------------
Old `HTTPValidationError` and `ValidationError` OpenAPI entry
Minimal Reproduction
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
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.
When NOT to Use This Fix
- Do not use if it changes public behavior or if the failure cannot be reproduced.
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.5 | Fixed |
Related Issues
No related fixes found.
Sources
We don’t republish the full GitHub discussion text. Use the links above for context.