The Fix
pip install pydantic==2.10.2
Based on closed pydantic/pydantic issue #10958 · 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%.
@@ -109,7 +109,7 @@ def collect_model_fields( # noqa: C901
parent_fields_lookup.update(model_fields)
- type_hints = _typing_extra.get_cls_type_hints(cls, ns_resolver=ns_resolver, lenient=True)
+ type_hints = _typing_extra.get_model_type_hints(cls, ns_resolver=ns_resolver)
pydantic version: 2.10.1
pydantic-core version: 2.27.1
pydantic-core build: profile=release pgo=false
install path: /usr/local/lib/python3.9/site-packages/pydantic
python version: 3.9.20 (main, Nov 12 2024, 23:14:42) [GCC 12.2.0]
platform: Linux-6.10.11-linuxkit-aarch64-with-glibc2.36
related packages: typing_extensions-4.12.2 fastapi-0.115.5 mypy-1.9.0
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==2.10.2\nWhen NOT to use: This fix should not be used if the application does not utilize forward annotations.\n\n
Why This Fix Works in Production
- Trigger: Missing `eval-type-backport` as required dependency in 2.10.* Pydantic line for Python 3.8/3.9
- Mechanism: Prevents evaluation of annotations for private fields, addressing the issue where Pydantic fails to import classes with forward annotations in Python 3.8 and 3.9.
- Why the fix works: Prevents evaluation of annotations for private fields, addressing the issue where Pydantic fails to import classes with forward annotations in Python 3.8 and 3.9. (first fixed release: 2.10.2).
- 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.8 in real deployments (not just unit tests).
- Production symptom (often without a traceback): Missing `eval-type-backport` as required dependency in 2.10.* Pydantic line for Python 3.8/3.9
Proof / Evidence
- GitHub issue: #10958
- Fix PR: https://github.com/pydantic/pydantic/pull/10962
- First fixed release: 2.10.2
- 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.55
Discussion
High-signal excerpts from the issue thread (symptoms, repros, edge-cases).
“Happy to test #10962 once it's merged to main - we know know that it should work for the right gitHub syntax in our CI”
“> Happy to test #10962 once it's merged to main It's not clear to me if the suggested syntax https://github.com/apache/airflow/pull/44260#discussion_r1852542551 worked in your CI, but…”
“> If you are curious, you can take a look at the implementation of the eval-type-backport. It is interesting stuff, but a bit scary at…”
“Runing the test here https://github.com/apache/airflow/pull/44339”
Failure Signature (Search String)
- Missing `eval-type-backport` as required dependency in 2.10.* Pydantic line for Python 3.8/3.9
- - this only broke private fields (i.e. prefixed by `_`), less common that "normal" fields. For "normal" fields, the exception would have been raised anyway in Pydantic < 2.10.
Copy-friendly signature
Failure Signature
-----------------
Missing `eval-type-backport` as required dependency in 2.10.* Pydantic line for Python 3.8/3.9
- this only broke private fields (i.e. prefixed by `_`), less common that "normal" fields. For "normal" fields, the exception would have been raised anyway in Pydantic < 2.10.
Error Message
Signature-only (no traceback captured)
Error Message
-------------
Missing `eval-type-backport` as required dependency in 2.10.* Pydantic line for Python 3.8/3.9
- this only broke private fields (i.e. prefixed by `_`), less common that "normal" fields. For "normal" fields, the exception would have been raised anyway in Pydantic < 2.10.
Minimal Reproduction
pydantic version: 2.10.1
pydantic-core version: 2.27.1
pydantic-core build: profile=release pgo=false
install path: /usr/local/lib/python3.9/site-packages/pydantic
python version: 3.9.20 (main, Nov 12 2024, 23:14:42) [GCC 12.2.0]
platform: Linux-6.10.11-linuxkit-aarch64-with-glibc2.36
related packages: typing_extensions-4.12.2 fastapi-0.115.5 mypy-1.9.0
commit: unknown
Environment
- Python: 3.8
- Pydantic: 2
What Broke
Users experience import failures when using Pydantic with base classes containing forward annotations.
Fix Options (Details)
Option A — Upgrade to fixed release Safe default (recommended)
pip install pydantic==2.10.2
Use when you can deploy the upstream fix. It is usually lower-risk than long-lived workarounds.
Option D — Guard side-effects with OnceOnly Guardrail for side-effects
Mitigate duplicate external side-effects under retries/timeouts/agent loops by gating the operation before calling external systems.
- Place OnceOnly between your code/agent and real side-effects (Stripe, emails, CRM, APIs).
- Use a stable key per side-effect (e.g., customer_id + action + idempotency_key).
- Fail-safe: configure fail-open vs fail-closed based on blast radius and spend risk.
Show example snippet (optional)
from onceonly import OnceOnly
import os
once = OnceOnly(api_key=os.environ["ONCEONLY_API_KEY"], fail_open=True)
# Stable idempotency key per real side-effect.
# Use a request id / job id / webhook delivery id / Stripe event id, etc.
event_id = "evt_..." # replace
key = f"stripe:webhook:{event_id}"
res = once.check_lock(key=key, ttl=3600)
if res.duplicate:
return {"status": "already_processed"}
# Safe to execute the side-effect exactly once.
handle_event(event_id)
Fix reference: https://github.com/pydantic/pydantic/pull/10962
First fixed release: 2.10.2
Last verified: 2026-02-09. Validate in your environment.
When NOT to Use This Fix
- This fix should not be used if the application does not utilize forward annotations.
- Do not use this to hide logic bugs or data corruption. Use it to block duplicate external side-effects and enforce tool permissions/spend caps.
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.10.2 | Broken |
| 2.10.2 | Fixed |
Related Issues
No related fixes found.
Sources
We don’t republish the full GitHub discussion text. Use the links above for context.