Jump to solution
Verify

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%.

Jump to Verify Open PR/Commit
@@ -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)
repro.py
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
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.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).
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.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

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”
@potiuk · 2024-11-24 · confirmation · source
“> 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…”
@Viicos · 2024-11-25 · confirmation · source
“> 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…”
@potiuk · 2024-11-25 · source
“Runing the test here https://github.com/apache/airflow/pull/44339”
@potiuk · 2024-11-25 · source

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
signature.txt
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.txt
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

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

When NOT to use: This fix should not be used if the application does not utilize forward annotations.

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)
onceonly.py
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)

See OnceOnly SDK

When NOT to use: 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.

Fix reference: https://github.com/pydantic/pydantic/pull/10962

First fixed release: 2.10.2

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

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