Jump to solution
Verify

The Fix

pip install pydantic==2.12.3

Based on closed pydantic/pydantic issue #12374 · 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
@@ -8,3 +8,10 @@ - computed_field - ComputedFieldInfo + filters: + - "!^from_field$" + - "!^from_annotation$"
repro.py
from pydantic.fields import FieldInfo class ChildFieldInfo(FieldInfo): def __init__(self): super().__init__() field_info = ChildFieldInfo.from_annotation(typing.Annotated[object, ChildFieldInfo()]) type(field_info) # ChildFieldInfo in < 2.12 # FieldInfo in >= 2.12 # However, in all versions.. type(ChildFieldInfo.from_annotation(typing.Annotated[object, ChildFieldInfo(), ChildFieldInfo()])) # FieldInfo
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.3\nWhen NOT to use: This fix is not suitable for libraries that depend on the previous mutable behavior of FieldInfo instances.\n\nOption B — Safe version pin\npip install pydantic==2.11\nWhen NOT to use: Do not use if you need features or security fixes in newer releases.\n\n

Why This Fix Works in Production

  • Trigger: Some changes in Pydantic 2.12 related to the `FieldInfo` class resulted in issues for libraries relying on this class and its methods. Such changes impact…
  • Mechanism: Adds a `FieldInfo.asdict()` method and improves documentation around `FieldInfo`, addressing issues related to dynamic model creation and the immutability of `FieldInfo` instances.
  • Why the fix works: Adds a `FieldInfo.asdict()` method and improves documentation around `FieldInfo`, addressing issues related to dynamic model creation and the immutability of `FieldInfo` instances. (first fixed release: 2.12.3).
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

  • Production symptom (often without a traceback): Some changes in Pydantic 2.12 related to the `FieldInfo` class resulted in issues for libraries relying on this class and its methods. Such changes impact behavior on:

Proof / Evidence

Discussion

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

“I just published 2.12.3 to PyPI, which includes the above. Closing as such.”
@Viicos · 2025-10-17 · confirmation · source
“I have a similar problem. Use case: remove all defaults from a (possibly nested) Pydantic model This code stopped working as expected. I have a…”
@kapis · 2025-10-12 · source
“I was using FieldInfo class to construct a "patch" version of a model”
@lxbanov · 2025-10-10 · source
“@Viicos , also, as I tested, mutations were possible and were respected in all version from 2.2.0 (Aug 17, 2023) to 2.11.10 (Oct 4, 2025).…”
@Danipulok · 2025-10-13 · source

Failure Signature (Search String)

  • Some changes in Pydantic 2.12 related to the `FieldInfo` class resulted in issues for libraries relying on this class and its methods. Such changes impact behavior on:
  • I'd be interested to get more feedback on logic you are currently using around the `FieldInfo` logic. I'd be happy to discuss potential workarounds if what I described above
Copy-friendly signature
signature.txt
Failure Signature ----------------- Some changes in Pydantic 2.12 related to the `FieldInfo` class resulted in issues for libraries relying on this class and its methods. Such changes impact behavior on: I'd be interested to get more feedback on logic you are currently using around the `FieldInfo` logic. I'd be happy to discuss potential workarounds if what I described above doesn't fulfill your use cases.

Error Message

Signature-only (no traceback captured)
error.txt
Error Message ------------- Some changes in Pydantic 2.12 related to the `FieldInfo` class resulted in issues for libraries relying on this class and its methods. Such changes impact behavior on: I'd be interested to get more feedback on logic you are currently using around the `FieldInfo` logic. I'd be happy to discuss potential workarounds if what I described above doesn't fulfill your use cases.

Minimal Reproduction

repro.py
from pydantic.fields import FieldInfo class ChildFieldInfo(FieldInfo): def __init__(self): super().__init__() field_info = ChildFieldInfo.from_annotation(typing.Annotated[object, ChildFieldInfo()]) type(field_info) # ChildFieldInfo in < 2.12 # FieldInfo in >= 2.12 # However, in all versions.. type(ChildFieldInfo.from_annotation(typing.Annotated[object, ChildFieldInfo(), ChildFieldInfo()])) # FieldInfo

Environment

  • Pydantic: 2.12

What Broke

Libraries relying on FieldInfo experienced unexpected behavior, leading to potential data integrity issues.

Fix Options (Details)

Option A — Upgrade to fixed release Safe default (recommended)

pip install pydantic==2.12.3

When NOT to use: This fix is not suitable for libraries that depend on the previous mutable behavior of FieldInfo instances.

Use when you can deploy the upstream fix. It is usually lower-risk than long-lived workarounds.

Option B — Safe version pin Backward-compatible pin

pip install pydantic==2.11

When NOT to use: Do not use if you need features or security fixes in newer releases.

Use when you can’t upgrade immediately. Plan a follow-up to upgrade (pins can accumulate security/compat debt).

Option D — Guard side-effects with OnceOnly Guardrail for side-effects

Mitigate duplicate external side-effects under retries/timeouts/agent loops by gating the operation before calling external systems.

  • Place OnceOnly between your code/agent and real side-effects (Stripe, emails, CRM, APIs).
  • Use a stable key per side-effect (e.g., customer_id + action + idempotency_key).
  • Fail-safe: configure fail-open vs fail-closed based on blast radius and spend risk.
Show example snippet (optional)
onceonly.py
from onceonly import OnceOnly import os once = OnceOnly(api_key=os.environ["ONCEONLY_API_KEY"], fail_open=True) # Stable idempotency key per real side-effect. # Use a request id / job id / webhook delivery id / Stripe event id, etc. event_id = "evt_..." # replace key = f"stripe:webhook:{event_id}" res = once.check_lock(key=key, ttl=3600) if res.duplicate: return {"status": "already_processed"} # Safe to execute the side-effect exactly once. handle_event(event_id)

See OnceOnly SDK

When NOT to use: Do not use this to hide logic bugs or data corruption. Use it to block duplicate external side-effects and enforce tool permissions/spend caps.

Fix reference: https://github.com/pydantic/pydantic/pull/12411

First fixed release: 2.12.3

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

  • This fix is not suitable for libraries that depend on the previous mutable behavior of FieldInfo instances.
  • Do not use if you need features or security fixes in newer releases.
  • Do not use this to hide logic bugs or data corruption. Use it to block duplicate external side-effects and enforce tool permissions/spend caps.

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.11 Working
2.12.3 Fixed

Related Issues

No related fixes found.

Sources

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