The Fix
pip install pydantic==2.11.0
Based on closed pydantic/pydantic issue #10873 · 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%.
@@ -15,6 +15,8 @@
from typing_extensions import ParamSpec, TypeAliasType, TypeIs, deprecated, get_args, get_origin
+from pydantic.version import version_short
+
from ._namespace_utils import GlobalsNamespace, MappingNamespace, NsResolver, get_module_ns_of
# module1.py
JsonData: TypeAlias = 'str | int | float | None | list[JsonData] | dict[str, JsonData]'
# module2.py
from module1 import JsonData
from pydantic import BaseModel
class Model(BaseModel):
a: JsonData
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.0\nWhen NOT to use: This fix should not be applied if the application relies on the previous behavior of recursion handling.\n\n
Why This Fix Works in Production
- Trigger: Users experienced crashes or unexpected behavior when using recursive type aliases.
- Mechanism: Recursion errors during type evaluation were not handled properly in the library
- Why the fix works: Improves exception message when encountering recursion errors during type evaluation, addressing issue #10873. (first fixed release: 2.11.0).
- 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
- Triggered by an upgrade/regression window: 3.12 breaks; 2.11.0 is the first fixed release.
- Shows up under Python 3.11 in real deployments (not just unit tests).
- Recursion errors during type evaluation were not handled properly in the library
- Production symptom (often without a traceback): Users experienced crashes or unexpected behavior when using recursive type aliases.
Proof / Evidence
- GitHub issue: #10873
- Fix PR: https://github.com/pydantic/pydantic/pull/11356
- First fixed release: 2.11.0
- Affected versions: 3.12
- 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.70
Discussion
High-signal excerpts from the issue thread (symptoms, repros, edge-cases).
“@jogo-openai, if you are using 3.12+: If using Python 3.11-:”
“@Viicos I was trying to follow along for the TypeAliasType route with this example but had trouble sorting out out. What is the workaround?”
“I don't think it is possible to safely support this”
Failure Signature (Search String)
- Users experienced crashes or unexpected behavior when using recursive type aliases.
Copy-friendly signature
Failure Signature
-----------------
Users experienced crashes or unexpected behavior when using recursive type aliases.
Error Message
Signature-only (no traceback captured)
Error Message
-------------
Users experienced crashes or unexpected behavior when using recursive type aliases.
Minimal Reproduction
# module1.py
JsonData: TypeAlias = 'str | int | float | None | list[JsonData] | dict[str, JsonData]'
# module2.py
from module1 import JsonData
from pydantic import BaseModel
class Model(BaseModel):
a: JsonData
Environment
- Python: 3.11
What Broke
Users experienced crashes or unexpected behavior when using recursive type aliases.
Why It Broke
Recursion errors during type evaluation were not handled properly in the library
Fix Options (Details)
Option A — Upgrade to fixed release Safe default (recommended)
pip install pydantic==2.11.0
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/11356
First fixed release: 2.11.0
Last verified: 2026-02-09. Validate in your environment.
When NOT to Use This Fix
- This fix should not be applied if the application relies on the previous behavior of recursion handling.
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 |
|---|---|
| 3.12 | Broken |
| 2.11.0 | Fixed |
Related Issues
No related fixes found.
Sources
We don’t republish the full GitHub discussion text. Use the links above for context.