The Fix
pip install pydantic==2.11.8
Based on closed pydantic/pydantic issue #11876 · PR/commit linked
@@ -326,18 +326,15 @@ def collect_model_fields( # noqa: C901
# extend this to any descriptor in the future (by simply checking for
# `hasattr(assigned_value.default, '__get__')`).
- assigned_value.default = assigned_value.default.__get__(None, cls)
-
- # The `from_annotated_attribute()` call below mutates the assigned `Field()`, so make a copy:
from pydantic import BaseModel, Field
from typing import Annotated
SimilarityLevel = Annotated[int, Field()]
class Foo(BaseModel):
sl: SimilarityLevel = 50
class Bar(BaseModel):
sl: Annotated[SimilarityLevel, Field()]
print(Bar.model_fields["sl"])
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.11.8\nWhen NOT to use: This fix should not be applied if global mutation of field defaults is intended.\n\n
Why This Fix Works in Production
- Trigger: Models using the same field type experienced unexpected default value changes.
- Mechanism: The implementation of FieldInfo creation led to global mutation of field defaults
- Why the fix works: Refactor `FieldInfo` creation implementation to prevent global mutation of field defaults. (first fixed release: 2.11.8).
- If left unfixed, this can cause silent data inconsistencies that propagate (bad cache entries, incorrect downstream decisions).
Why This Breaks in Prod
- The implementation of FieldInfo creation led to global mutation of field defaults
- Production symptom (often without a traceback): Models using the same field type experienced unexpected default value changes.
Proof / Evidence
- GitHub issue: #11876
- Fix PR: https://github.com/pydantic/pydantic/pull/11898
- First fixed release: 2.11.8
- 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.58
Verified Execution
We executed the runnable minimal repro in a temporary environment and captured exit codes + logs.
- Status: PASS
- Ran: 2026-02-11T16:52:29Z
- Package: pydantic
- Fixed: 2.11.8
- Mode: fixed_only
- Outcome: ok
Logs
annotation=int required=True
Discussion
High-signal excerpts from the issue thread (symptoms, repros, edge-cases).
“### Initial Checks - [x] I confirm that I'm using Pydantic V2 ### Description When defining a custom type with a Field annotation, its default gets mutated globally whenever it is set in a specific model. See the minimal reproduction exampl”
Failure Signature (Search String)
- Models using the same field type experienced unexpected default value changes.
Copy-friendly signature
Failure Signature
-----------------
Models using the same field type experienced unexpected default value changes.
Error Message
Signature-only (no traceback captured)
Error Message
-------------
Models using the same field type experienced unexpected default value changes.
Minimal Reproduction
from pydantic import BaseModel, Field
from typing import Annotated
SimilarityLevel = Annotated[int, Field()]
class Foo(BaseModel):
sl: SimilarityLevel = 50
class Bar(BaseModel):
sl: Annotated[SimilarityLevel, Field()]
print(Bar.model_fields["sl"])
Environment
- Pydantic: 2
What Broke
Models using the same field type experienced unexpected default value changes.
Why It Broke
The implementation of FieldInfo creation led to global mutation of field defaults
Fix Options (Details)
Option A — Upgrade to fixed release Safe default (recommended)
pip install pydantic==2.11.8
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/11898
First fixed release: 2.11.8
Last verified: 2026-02-09. Validate in your environment.
When NOT to Use This Fix
- This fix should not be applied if global mutation of field defaults is intended.
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.8 | Fixed |
Related Issues
No related fixes found.
Sources
We don’t republish the full GitHub discussion text. Use the links above for context.