The Fix
pip install fastapi==0.128.5
Based on closed fastapi/fastapi issue #10286 · 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,18 @@ def alias(self) -> str:
return a if a is not None else self.name
+ @property
+ def validation_alias(self) -> Union[str, None]:
+ va = self.field_info.validation_alias
from typing import Annotated
from fastapi import Body, Cookie, FastAPI, Form, UploadFile, File, Query, Header, Path
app = FastAPI()
@app.post("/{path}")
def endpoint(
path: Annotated[int, Path(alias="PathAlias")],
cookie: Annotated[int, Cookie(alias="CookieAlias")],
header: Annotated[int, Header(alias="HeaderAlias")],
query: Annotated[int, Query(alias="QueryAlias")],
body: Annotated[int, Body(alias="BodyAlias")],
form: Annotated[int, Form(alias="FormAlias")],
file: Annotated[UploadFile, File(alias="FileAlias")],
):
...
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 this fix if you rely on the previous behavior of validation_alias.\n\nOption C — Workaround\ndidn't work for me, am I doing something wrong?\nWhen NOT to use: Do not use this fix if you rely on the previous behavior of validation_alias.\n\n
Why This Fix Works in Production
- Trigger: People can overcome this right now using `validation_alias` as follows:
- Mechanism: The Body, Form, and File parameters did not support alias, causing inconsistency
- Why the fix works: Fixes the issue where Body, Form, and File parameters did not support alias, ensuring consistency with Path and Cookie parameters. (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 Body, Form, and File parameters did not support alias, causing inconsistency
- Production symptom (often without a traceback): People can overcome this right now using `validation_alias` as follows:
Proof / Evidence
- GitHub issue: #10286
- Fix PR: https://github.com/fastapi/fastapi/pull/14371
- 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.57
Discussion
High-signal excerpts from the issue thread (symptoms, repros, edge-cases).
“**When I use only validation_alias in Form I can see alias in Swagger, but the validation is not working well”
“Hi, as @Kludex told me to watch this issue I wanted to make sure if I apply the workaround correctly as it is not (maybe…”
“@Kludex I have a question”
“I request a PR #10319 to fix it. Now I can use alias in Form and File”
Failure Signature (Search String)
- People can overcome this right now using `validation_alias` as follows:
- body: Annotated[int, Body(validation_alias="BodyAlias")],
Copy-friendly signature
Failure Signature
-----------------
People can overcome this right now using `validation_alias` as follows:
body: Annotated[int, Body(validation_alias="BodyAlias")],
Error Message
Signature-only (no traceback captured)
Error Message
-------------
People can overcome this right now using `validation_alias` as follows:
body: Annotated[int, Body(validation_alias="BodyAlias")],
Minimal Reproduction
from typing import Annotated
from fastapi import Body, Cookie, FastAPI, Form, UploadFile, File, Query, Header, Path
app = FastAPI()
@app.post("/{path}")
def endpoint(
path: Annotated[int, Path(alias="PathAlias")],
cookie: Annotated[int, Cookie(alias="CookieAlias")],
header: Annotated[int, Header(alias="HeaderAlias")],
query: Annotated[int, Query(alias="QueryAlias")],
body: Annotated[int, Body(alias="BodyAlias")],
form: Annotated[int, Form(alias="FormAlias")],
file: Annotated[UploadFile, File(alias="FileAlias")],
):
...
Environment
- Pydantic: 2
What Broke
Users could not use aliases in Body, Form, and File parameters, leading to confusion.
Why It Broke
The Body, Form, and File parameters did not support alias, causing inconsistency
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.
Option C — Workaround Temporary workaround
didn't work for me, am I doing something wrong?
Use only if you cannot change versions today. Treat this as a stopgap and remove once upgraded.
Fix reference: https://github.com/fastapi/fastapi/pull/14371
First fixed release: 0.128.5
Last verified: 2026-02-09. Validate in your environment.
When NOT to Use This Fix
- Do not use this fix if you rely on the previous behavior of validation_alias.
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.