Jump to solution
Verify

The Fix

pip install pydantic==2.11.0

Based on closed pydantic/pydantic issue #11320 · PR/commit linked

Jump to Verify Open PR/Commit
@@ -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
repro.py
from pydantic import BaseModel JSONable = dict[str, "JSONable"] | list["JSONable"] | str | int | float | bool | None class ArbitraryData(BaseModel): data: JSONable
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.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

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…”
@rrauenza · 2025-10-01 · source
“For those requiring Python < 3.12, @rrauenza 's suggestion of type JSONable = ... isn't valid syntax. But you can use the backport of that…”
@ihincks · 2026-01-28 · source

Failure Signature (Search String)

  • RecursionError with recursive types.

Error Message

Stack trace
error.txt
Error Message ------------- RecursionError with recursive types.

Minimal Reproduction

repro.py
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

When NOT to use: This fix is not applicable for non-recursive type definitions.

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.

Get updates

We publish verified fixes weekly. No spam.

Subscribe

When NOT to Use This Fix

  • This fix is not applicable for non-recursive type definitions.

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

Related Issues

No related fixes found.

Sources

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