Jump to solution
Verify

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.

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

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”
@Viicos · 2025-08-02 · source
“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…”
@DavidNemeskey · 2025-08-12 · source
“Basically, I would like to replace each occurrence of EmailStr with str”
@DavidNemeskey · 2025-08-02 · source
“I'm going to close this issue”
@Viicos · 2025-08-12 · source

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
signature.txt
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.txt
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

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

When NOT to use: This fix should not be applied if the existing model relies on deprecated 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/11898

First fixed release: 2.11.8

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 should not be applied if the existing model relies on deprecated 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.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.