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%.
@@ -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'
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
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==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).
- 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
- GitHub issue: #10747
- Fix PR: https://github.com/pydantic/pydantic/pull/9612
- First fixed release: 1.10.16
- Reproduced locally: No (not executed)
- Last verified: 2026-02-09
- Confidence: 0.85
- Did this fix it?: Yes (upstream fix exists)
- Own content ratio: 0.46
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”
“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...…”
“The best way for you would be to recreate your venv, I can't provide more help here.”
“Thank you! Recreating the venv didn't work, but I did a clean reinstall and the problem went away”
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 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
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
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.
When NOT to Use This Fix
- Do not use if it changes public behavior or if the failure cannot be reproduced.
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 |
|---|---|
| 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.