Jump to solution
Verify

The Fix

pip install pydantic==1.10.16

Based on closed pydantic/pydantic issue #10747 · 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
@@ -63,7 +63,9 @@ def evaluate_forwardref(type_: ForwardRef, globalns: Any, localns: Any) -> Any: # Even though it is the right signature for python 3.9, mypy complains with # `error: Too many arguments for "_evaluate" of "ForwardRef"` hence the cast... - return cast(Any, type_)._evaluate(globalns, localns, set()) + # Python 3.13/3.12.4+ made `recursive_guard` a kwarg, so name it explicitly to avoid: + # TypeError: ForwardRef._evaluate() missing 1 required keyword-only argument: 'recursive_guard'
repro.py
pydantic version: 2.9.2 pydantic-core version: 2.23.4 pydantic-core build: profile=release pgo=false install path: C:\work\ASI-DRI-Copilot\.venv\Lib\site-packages\pydantic python version: 3.12.7 (tags/v3.12.7:0b05ead, Oct 1 2024, 03:06:41) [MSC v.1941 64 bit (AMD64)] platform: Windows-11-10.0.26100-SP0 related packages: fastapi-0.115.4 mypy-1.13.0 pydantic-settings-2.6.0 typing_extensions-4.12.2 commit: unknown
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==1.10.16\nWhen NOT to use: Do not use if it changes public behavior or if the failure cannot be reproduced.\n\n

Why This Fix Works in Production

  • Trigger: TypeError: ForwardRef._evaluate() missing 1 required keyword-only argument: 'recursive_guard' still occurs with v2.9.2 on Python 3.12.7
  • Mechanism: Specifies 'recursive_guard' as a keyword argument in the 'ForwardRef._evaluate' method to resolve a TypeError that occurs in Python 3.12.4 and later.
  • Why the fix works: Specifies 'recursive_guard' as a keyword argument in the 'ForwardRef._evaluate' method to resolve a TypeError that occurs in Python 3.12.4 and later. (first fixed release: 1.10.16).
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

  • Shows up under Python 3.12.7 in real deployments (not just unit tests).
  • Surfaces as: TypeError: ForwardRef._evaluate() missing 1 required keyword-only argument: 'recursive_guard' still occurs with v2.9.2 on Python 3.12.7

Proof / Evidence

Discussion

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

“Seems like an env issue on your end. Here's the source code on 2.9.2: https://github.com/pydantic/pydantic/blob/7cedbfb03df82ac55c844c97e6f975359cb51bb9/pydantic/v1/typing.py#L63-L68”
@Viicos · 2024-10-31 · source
“Thank you for responding. However, it's not clear to me (sorry, Python n00b) and there's no suitable guidance documented elsewhere, on how to resolve this...…”
@johnazariah · 2024-10-31 · source
“The best way for you would be to recreate your venv, I can't provide more help here.”
@Viicos · 2024-10-31 · source
“Thank you! Recreating the venv didn't work, but I did a clean reinstall and the problem went away”
@johnazariah · 2024-10-31 · source

Failure Signature (Search String)

  • TypeError: ForwardRef._evaluate() missing 1 required keyword-only argument: 'recursive_guard' still occurs with v2.9.2 on Python 3.12.7

Error Message

Stack trace
error.txt
Error Message ------------- TypeError: ForwardRef._evaluate() missing 1 required keyword-only argument: 'recursive_guard' still occurs with v2.9.2 on Python 3.12.7

Minimal Reproduction

repro.py
pydantic version: 2.9.2 pydantic-core version: 2.23.4 pydantic-core build: profile=release pgo=false install path: C:\work\ASI-DRI-Copilot\.venv\Lib\site-packages\pydantic python version: 3.12.7 (tags/v3.12.7:0b05ead, Oct 1 2024, 03:06:41) [MSC v.1941 64 bit (AMD64)] platform: Windows-11-10.0.26100-SP0 related packages: fastapi-0.115.4 mypy-1.13.0 pydantic-settings-2.6.0 typing_extensions-4.12.2 commit: unknown

Environment

  • Python: 3.12.7
  • Pydantic: 2

Fix Options (Details)

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

pip install pydantic==1.10.16

When NOT to use: Do not use if it changes public behavior or if the failure cannot be reproduced.

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

First fixed release: 1.10.16

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

  • Do not use if it changes public behavior or if the failure cannot be reproduced.

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
1.10.16 Fixed

Related Issues

No related fixes found.

Sources

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