The Fix
pip install pydantic==2.12.5
Based on closed pydantic/pydantic issue #12450 · 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%.
@@ -216,7 +216,7 @@ def update_field_from_config(config_wrapper: ConfigWrapper, field_name: str, fie
cls: type[BaseModel],
config_wrapper: ConfigWrapper,
- ns_resolver: NsResolver | None,
+ ns_resolver: NsResolver,
*,
from typing import Annotated
from pydantic import BaseModel, Field
class Model[T](BaseModel):
t: T
M = Model[Annotated[int, Field(gt=1)]]
M.model_fields['t']
#> FieldInfo(annotation=Annotated[int, FieldInfo(annotation=NoneType, required=True, metadata=[Gt(gt=1)])], required=True)
Re-run the minimal reproduction on your broken version, then apply the fix and re-run.
Option A — Upgrade to fixed release\npip install pydantic==2.12.5\nWhen NOT to use: Do not use this fix if the model relies on non-parameterized behavior.\n\n
Why This Fix Works in Production
- Trigger: Metadata propagation inconsistently fails between generic and regular models, causing unexpected behavior.
- Mechanism: FieldInfo from Annotated arguments isn't being expanded when used in a parameterized GenericModel
- Why the fix works: Fixes the issue where FieldInfo from Annotated arguments isn't being expanded when used in a parameterized GenericModel, ensuring consistent metadata propagation. (first fixed release: 2.12.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
- FieldInfo from Annotated arguments isn't being expanded when used in a parameterized GenericModel
- Production symptom (often without a traceback): Metadata propagation inconsistently fails between generic and regular models, causing unexpected behavior.
Proof / Evidence
- GitHub issue: #12450
- Fix PR: https://github.com/pydantic/pydantic/pull/12463
- First fixed release: 2.12.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.67
Discussion
High-signal excerpts from the issue thread (symptoms, repros, edge-cases).
“@August26 Feel free to give it a shot, I'll note that it might be not trivial.”
“Hi 👋 I’ve reproduced this issue and verified that the root cause is that FieldInfo from Annotated arguments isn’t being expanded when used in a…”
Failure Signature (Search String)
- Metadata propagation inconsistently fails between generic and regular models, causing unexpected behavior.
Copy-friendly signature
Failure Signature
-----------------
Metadata propagation inconsistently fails between generic and regular models, causing unexpected behavior.
Error Message
Signature-only (no traceback captured)
Error Message
-------------
Metadata propagation inconsistently fails between generic and regular models, causing unexpected behavior.
Minimal Reproduction
from typing import Annotated
from pydantic import BaseModel, Field
class Model[T](BaseModel):
t: T
M = Model[Annotated[int, Field(gt=1)]]
M.model_fields['t']
#> FieldInfo(annotation=Annotated[int, FieldInfo(annotation=NoneType, required=True, metadata=[Gt(gt=1)])], required=True)
What Broke
Metadata propagation inconsistently fails between generic and regular models, causing unexpected behavior.
Why It Broke
FieldInfo from Annotated arguments isn't being expanded when used in a parameterized GenericModel
Fix Options (Details)
Option A — Upgrade to fixed release Safe default (recommended)
pip install pydantic==2.12.5
Use when you can deploy the upstream fix. It is usually lower-risk than long-lived workarounds.
Fix reference: https://github.com/pydantic/pydantic/pull/12463
First fixed release: 2.12.5
Last verified: 2026-02-09. Validate in your environment.
When NOT to Use This Fix
- Do not use this fix if the model relies on non-parameterized behavior.
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
- Add a CI check that diffs key outputs after upgrades (OpenAPI schema snapshots, JSON payload shapes, CLI output).
- Upgrade behind a canary and run integration tests against the canary before 100% rollout.
Version Compatibility Table
| Version | Status |
|---|---|
| 2.12.5 | Fixed |
Related Issues
No related fixes found.
Sources
We don’t republish the full GitHub discussion text. Use the links above for context.