The Fix
pip install pydantic==2.11.0
Based on closed pydantic/pydantic issue #11320 · PR/commit linked
@@ -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
from pydantic import BaseModel
JSONable = dict[str, "JSONable"] | list["JSONable"] | str | int | float | bool | None
class ArbitraryData(BaseModel):
data: JSONable
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 is not applicable for non-recursive type definitions.\n\n
Why This Fix Works in Production
- Trigger: RecursionError with recursive types.
- Mechanism: Recursion errors occur during type evaluation due to implicit recursive type aliases
- Why the fix works: Improves the exception message when encountering recursion errors during type evaluation, addressing issue #11320. (first fixed release: 2.11.0).
Why This Breaks in Prod
- Recursion errors occur during type evaluation due to implicit recursive type aliases
- Surfaces as: RecursionError with recursive types.
Proof / Evidence
- GitHub issue: #11320
- Fix PR: https://github.com/pydantic/pydantic/pull/11356
- First fixed release: 2.11.0
- 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.68
Discussion
High-signal excerpts from the issue thread (symptoms, repros, edge-cases).
“FYI, using TypeAlias doesn't work: JSONable: typing.TypeAlias = dict[str, "JSONable"] | list["JSONable"] | str | int | float | bool | None But type JSONable…”
“For those requiring Python < 3.12, @rrauenza 's suggestion of type JSONable = ... isn't valid syntax. But you can use the backport of that…”
Failure Signature (Search String)
- RecursionError with recursive types.
Error Message
Stack trace
Error Message
-------------
RecursionError with recursive types.
Minimal Reproduction
from pydantic import BaseModel
JSONable = dict[str, "JSONable"] | list["JSONable"] | str | int | float | bool | None
class ArbitraryData(BaseModel):
data: JSONable
Environment
- Pydantic: 2
What Broke
Users experience maximum recursion depth exceeded errors when using recursive types.
Why It Broke
Recursion errors occur during type evaluation due to implicit recursive type aliases
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 is not applicable for non-recursive type definitions.
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 |
|---|---|
| 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.