Jump to solution
Verify

The Fix

pip install pydantic==1.10.20

Based on closed pydantic/pydantic issue #11183 · 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
@@ -11,7 +11,7 @@ from functools import lru_cache, partial from types import FunctionType -from typing import Any, Callable, Generic, Literal, NoReturn, TypeVar, cast +from typing import Any, Callable, Generic, Literal, NoReturn, cast
repro.py
from pydantic import BaseModel class Inner[T](BaseModel): v: T class Holder(BaseModel): inner: Inner[int] # Note that unlike "normal" classes, parametrized generic Pydantic models are classes themselves. # This means that `Inner[int]` is a class (and not a generic alias instance), and # `Inner[int].mro() == [Inner[int], Inner, BaseModel, object]` Holder(inner=Inner[int](v=1)) # ok, `isinstance(Inner[int](v=1), Inner[int]) == True` Holder(inner=Inner(v=1)) # not ok, `isinstance(Inner(v=1), Inner[int]) == False`, although this is valid # for static type checkers as the type variable is implicitly solved to `int`.
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==1.10.20\nWhen NOT to use: Do not apply this fix if custom MRO behavior is required for specific use cases.\n\n

Why This Fix Works in Production

  • Trigger: Validation of parametrized generics issues
  • Mechanism: The custom MRO implementation for Pydantic models was unnecessary due to previous changes
  • Why the fix works: Removed the custom MRO implementation for Pydantic models as it is no longer necessary due to previous changes. (first fixed release: 1.10.20).
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

  • The custom MRO implementation for Pydantic models was unnecessary due to previous changes
  • Production symptom (often without a traceback): Validation of parametrized generics issues

Proof / Evidence

Discussion

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

“This all sounds good to me @Viicos. Thanks for summarizing and providing clear examples.”
@sydney-runkle · 2024-12-27 · source
“One question: Did you mean isinstance(Inner[str](), Inner) (emphasis on the str, not int)?”
@sydney-runkle · 2024-12-27 · source
“We are going to remove the custom MRO implementation for now and keep the origin fallback "workaround"”
@Viicos · 2024-12-27 · source

Failure Signature (Search String)

  • Validation of parametrized generics issues
  • In this example, `pydantic-core` did an `isinstance(Model2(), Model1)` check and this failed.
Copy-friendly signature
signature.txt
Failure Signature ----------------- Validation of parametrized generics issues In this example, `pydantic-core` did an `isinstance(Model2(), Model1)` check and this failed.

Error Message

Signature-only (no traceback captured)
error.txt
Error Message ------------- Validation of parametrized generics issues In this example, `pydantic-core` did an `isinstance(Model2(), Model1)` check and this failed.

Minimal Reproduction

repro.py
from pydantic import BaseModel class Inner[T](BaseModel): v: T class Holder(BaseModel): inner: Inner[int] # Note that unlike "normal" classes, parametrized generic Pydantic models are classes themselves. # This means that `Inner[int]` is a class (and not a generic alias instance), and # `Inner[int].mro() == [Inner[int], Inner, BaseModel, object]` Holder(inner=Inner[int](v=1)) # ok, `isinstance(Inner[int](v=1), Inner[int]) == True` Holder(inner=Inner(v=1)) # not ok, `isinstance(Inner(v=1), Inner[int]) == False`, although this is valid # for static type checkers as the type variable is implicitly solved to `int`.

Environment

  • Pydantic: 2

What Broke

Invalid instances of parametrized generics were allowed, leading to potential runtime errors.

Why It Broke

The custom MRO implementation for Pydantic models was unnecessary due to previous changes

Fix Options (Details)

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

pip install pydantic==1.10.20

When NOT to use: Do not apply this fix if custom MRO behavior is required for specific use cases.

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

First fixed release: 1.10.20

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 custom MRO behavior is required for specific use cases.

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
1.10.20 Fixed

Related Issues

No related fixes found.

Sources

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