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%.
@@ -8,3 +8,10 @@
- computed_field
- ComputedFieldInfo
+ filters:
+ - "!^from_field$"
+ - "!^from_annotation$"
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
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.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).
- 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
- GitHub issue: #12374
- Fix PR: https://github.com/pydantic/pydantic/pull/12411
- First fixed release: 2.12.3
- 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.61
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.”
“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…”
“I was using FieldInfo class to construct a "patch" version of a model”
“@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).…”
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
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 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
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
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
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)
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)
Fix reference: https://github.com/pydantic/pydantic/pull/12411
First fixed release: 2.12.3
Last verified: 2026-02-09. Validate in your environment.
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
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.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.