Jump to solution
Verify

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%.

Jump to Verify Open PR/Commit
@@ -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, *,
repro.py
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)
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 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).
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

  • 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

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.”
@Viicos · 2025-10-27 · source
“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…”
@August26 · 2025-10-26 · source

Failure Signature (Search String)

  • Metadata propagation inconsistently fails between generic and regular models, causing unexpected behavior.
Copy-friendly signature
signature.txt
Failure Signature ----------------- Metadata propagation inconsistently fails between generic and regular models, causing unexpected behavior.

Error Message

Signature-only (no traceback captured)
error.txt
Error Message ------------- Metadata propagation inconsistently fails between generic and regular models, causing unexpected behavior.

Minimal Reproduction

repro.py
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

When NOT to use: Do not use this fix if the model relies on non-parameterized behavior.

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.

Get updates

We publish verified fixes weekly. No spam.

Subscribe

When NOT to Use This Fix

  • Do not use this fix if the model relies on non-parameterized behavior.

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

  • 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

VersionStatus
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.