Jump to solution
Verify

The Fix

pip install pydantic==2.11.0

Based on closed pydantic/pydantic issue #8785 · 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, TypeAdapter class RecursiveDict(BaseModel): d: dict[str, 'RecursiveDict'] adapter = TypeAdapter(RecursiveDict)
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 types or when using BaseModel.\n\n

Why This Fix Works in Production

  • Trigger: Recursive `dict` causes infinite recursion during schema generation
  • Mechanism: Using recursive types without BaseModel leads to infinite recursion during schema generation
  • Why the fix works: Improves the exception message when encountering recursion errors during type evaluation, addressing infinite recursion issues with recursive dict types. (first fixed release: 2.11.0).

Why This Breaks in Prod

  • Shows up under Python 3.11 in real deployments (not just unit tests).
  • Using recursive types without BaseModel leads to infinite recursion during schema generation
  • Production symptom (often without a traceback): Recursive `dict` causes infinite recursion during schema generation

Proof / Evidence

Verified Execution

We executed the runnable minimal repro in a temporary environment and captured exit codes + logs.

  • Status: PASS
  • Ran: 2026-02-11T16:52:29Z
  • Package: pydantic
  • Fixed: 2.11.0
  • Mode: fixed_only
  • Outcome: ok
Logs
affected (exit=None)
fixed (exit=0)

Discussion

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

“@nick-griaznov, Hmph, thanks for reporting this. At a first glance, this is definitely something that we want to support, especially because it's something that we…”
@sydney-runkle · 2024-02-12 · source
“@dmontagu, If you have some extra time this week, I know you mentioned you might be interested in looking into a fix for this.”
@sydney-runkle · 2024-02-13 · source
“@Viicos, maybe we could revisit this - I feel like this is probably related to the annotation resolution stuff that we've been looking at.”
@sydney-runkle · 2024-10-11 · source

Failure Signature (Search String)

  • Recursive `dict` causes infinite recursion during schema generation
  • This will fail:
Copy-friendly signature
signature.txt
Failure Signature ----------------- Recursive `dict` causes infinite recursion during schema generation This will fail:

Error Message

Signature-only (no traceback captured)
error.txt
Error Message ------------- Recursive `dict` causes infinite recursion during schema generation This will fail:

Minimal Reproduction

repro.py
from pydantic import BaseModel, TypeAdapter class RecursiveDict(BaseModel): d: dict[str, 'RecursiveDict'] adapter = TypeAdapter(RecursiveDict)

Environment

  • Python: 3.11
  • Pydantic: 2

What Broke

Infinite recursion causes application crashes and unresponsive behavior during type evaluation.

Why It Broke

Using recursive types without BaseModel leads to infinite recursion during schema generation

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 types or when using BaseModel.

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 types or when using BaseModel.

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.