Jump to solution
Verify

The Fix

pip install pydantic==2.10.1

Based on closed pydantic/pydantic issue #10892 · 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
@@ -4,6 +4,7 @@ import sys from dataclasses import is_dataclass +from types import FrameType from typing import ( Any,
repro.py
from pydantic import TypeAdapter TAInt = TypeAdapter[int] TAInt.__class__ #> typing._GenericAlias
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.10.1\nWhen NOT to use: This fix should not be used if the type adaptation relies on the behavior of `_GenericAlias`.\n\n

Why This Fix Works in Production

  • Trigger: assert TypeAdapter[int]('Text').core_schema == {'type': 'int'}
  • Mechanism: The wrong parent frame is fetched due to the proxy behavior of `_GenericAlias` in `TypeAdapter` instantiation
  • Why the fix works: Fixes the issue of wrong parent namespace being fetched when using an explicitly parametrized `TypeAdapter`. (first fixed release: 2.10.1).
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 wrong parent frame is fetched due to the proxy behavior of `_GenericAlias` in `TypeAdapter` instantiation
  • Production symptom (often without a traceback): assert TypeAdapter[int]('Text').core_schema == {'type': 'int'}

Proof / Evidence

Discussion

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

“This is a nice write up to clarify the core issue. When the parameterized type is inconsistent, is a runtime error raised? Or is this…”
@mpkocher · 2024-11-20 · source
“> When the parameterized type is inconsistent, is a runtime error raised? Or is this error mode on the static analysis tools side of the…”
@Viicos · 2024-11-21 · source

Failure Signature (Search String)

  • assert TypeAdapter[int]('Text').core_schema == {'type': 'int'}
  • When the parameterized type is inconsistent, is a runtime error raised? Or is this error mode on the static analysis tools side of the fence?
Copy-friendly signature
signature.txt
Failure Signature ----------------- assert TypeAdapter[int]('Text').core_schema == {'type': 'int'} When the parameterized type is inconsistent, is a runtime error raised? Or is this error mode on the static analysis tools side of the fence?

Error Message

Signature-only (no traceback captured)
error.txt
Error Message ------------- assert TypeAdapter[int]('Text').core_schema == {'type': 'int'} When the parameterized type is inconsistent, is a runtime error raised? Or is this error mode on the static analysis tools side of the fence?

Minimal Reproduction

repro.py
from pydantic import TypeAdapter TAInt = TypeAdapter[int] TAInt.__class__ #> typing._GenericAlias

Environment

  • Pydantic: 2

What Broke

Incorrect type validation occurs, leading to assertion errors in type adaptation.

Why It Broke

The wrong parent frame is fetched due to the proxy behavior of `_GenericAlias` in `TypeAdapter` instantiation

Fix Options (Details)

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

pip install pydantic==2.10.1

When NOT to use: This fix should not be used if the type adaptation relies on the behavior of `_GenericAlias`.

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

First fixed release: 2.10.1

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 used if the type adaptation relies on the behavior of `_GenericAlias`.

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

Related Issues

No related fixes found.

Sources

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