Jump to solution
Verify

The Fix

pip install pydantic==2.11.2

Based on closed pydantic/pydantic issue #11663 · 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
@@ -202,24 +202,23 @@ def collect_model_fields( # noqa: C901 if assigned_value is PydanticUndefined: # no assignment, just a plain annotation - if ann_name in annotations: - # field is present in the current model's annotations (and *not* from parent classes) + if ann_name in annotations or ann_name not in parent_fields_lookup:
repro.py
from typing import List from pydantic import BaseModel from child import Child class Parent(BaseModel): children: List[Child] = []
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.2\nWhen NOT to use: Do not apply this fix if your model does not use forward references.\n\n

Why This Fix Works in Production

  • Trigger: parent.py:
  • Mechanism: Field annotations are not resolved correctly in inherited classes when using forward references
  • Why the fix works: Addresses a regression that caused issues with forward references in inherited classes, ensuring that field annotations are resolved correctly. (first fixed release: 2.11.2).
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

  • Field annotations are not resolved correctly in inherited classes when using forward references
  • Surfaces as: parent.py:

Proof / Evidence

Discussion

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

“Update, the requirement for implicit imports goes away if I remove from __future__ import annotations import from the child class - but the validation issue…”
@R0ll1ngSt0ne · 2025-03-31 · source
“Thanks for the bug report, this will be addressed in the next patch release.”
@Viicos · 2025-04-01 · source

Failure Signature (Search String)

  • parent.py:

Error Message

Stack trace
error.txt
Error Message ------------- parent.py: ---------- from typing import List from pydantic import BaseModel from child import Child class Parent(BaseModel): children: List[Child] = [] child.py: --------- from __future__ import annotations from typing import TYPE_CHECKING, List, Optional from pydantic import BaseModel if TYPE_CHECKING: from parent import Parent class Child(BaseModel): name: str = "test" parents: Optional[List["Parent"]] = None main.py: -------- from parent import Parent from child import Child Child.model_rebuild() class ExtendedChild(Child): name: str = "MyB" b = ExtendedChild() output: ------- ... pydantic.errors.PydanticUserError: `ExtendedChild` is not fully defined; you should define `Optional`, then call `ExtendedChild.model_rebuild()`.

Minimal Reproduction

repro.py
from typing import List from pydantic import BaseModel from child import Child class Parent(BaseModel): children: List[Child] = []

Environment

  • Pydantic: 2

What Broke

Validation errors occur due to missing default values in inherited classes.

Why It Broke

Field annotations are not resolved correctly in inherited classes when using forward references

Fix Options (Details)

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

pip install pydantic==2.11.2

When NOT to use: Do not apply this fix if your model does not use forward references.

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/11668

First fixed release: 2.11.2

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

  • Do not apply this fix if your model does not use forward references.

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.2 Fixed

Related Issues

No related fixes found.

Sources

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