The Fix
pip install pydantic==2.11.8
Based on closed pydantic/pydantic issue #12115 · PR/commit linked
Production note: This usually shows up under retries/timeouts. Treat it as a side-effect risk until you can verify behavior with a canary + real traffic.
@@ -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, EmailStr
class MyModel(BaseModel):
work_email: EmailStr
home_email: Optional[EmailStr] = None
phone_number: str
class MyModelFixed(BaseModel):
work_email: str
home_email: Optional[str] = None
phone_number: str
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 the existing model relies on deprecated behavior.\n\n
Why This Fix Works in Production
- Trigger: A little context: I was trying to write some code that creates a "stripped down version" of a schema to be used with Gemini
- Mechanism: Refactor of `FieldInfo` creation logic led to improved metadata handling
- Why the fix works: Refactor `FieldInfo` creation implementation to improve merging logic and avoid buggy metadata handling. (first fixed release: 2.11.8).
Why This Breaks in Prod
- Refactor of `FieldInfo` creation logic led to improved metadata handling
- Production symptom (often without a traceback): A little context: I was trying to write some code that creates a "stripped down version" of a schema to be used with Gemini
Proof / Evidence
- GitHub issue: #12115
- 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.56
Discussion
High-signal excerpts from the issue thread (symptoms, repros, edge-cases).
“Can you provide more information on your use case? I'm having trouble following why you are using the FieldInfo class directly”
“The schema with the modifications described above works in Gemini. I just didn't want to manually rewrite (duplicate) a whole set of schema classes, but…”
“Basically, I would like to replace each occurrence of EmailStr with str”
“I'm going to close this issue”
Failure Signature (Search String)
- A little context: I was trying to write some code that creates a "stripped down version" of a schema to be used with Gemini
- By _schema_, what are you referring to exactly? What kind of input are you providing to Gemini?
Copy-friendly signature
Failure Signature
-----------------
A little context: I was trying to write some code that creates a "stripped down version" of a schema to be used with Gemini
By _schema_, what are you referring to exactly? What kind of input are you providing to Gemini?
Error Message
Signature-only (no traceback captured)
Error Message
-------------
A little context: I was trying to write some code that creates a "stripped down version" of a schema to be used with Gemini
By _schema_, what are you referring to exactly? What kind of input are you providing to Gemini?
Minimal Reproduction
from pydantic import BaseModel, EmailStr
class MyModel(BaseModel):
work_email: EmailStr
home_email: Optional[EmailStr] = None
phone_number: str
class MyModelFixed(BaseModel):
work_email: str
home_email: Optional[str] = None
phone_number: str
What Broke
Users faced difficulties in creating models due to unclear documentation and buggy metadata handling.
Why It Broke
Refactor of `FieldInfo` creation logic led to improved metadata handling
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 the existing model relies on deprecated 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.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.