The Fix
pip install pydantic==2.12.4
Based on closed pydantic/pydantic issue #12421 · PR/commit linked
@@ -526,6 +526,13 @@ def _eval_type(
localns,
type_params=type_params,
+ # This is relevant when evaluating types from `TypedDict` classes, where string annotations
+ # are automatically converted to `ForwardRef` instances with a module set. In this case,
+ # Our `globalns` is irrelevant and we need to indicate `typing._eval_type()` that it should
from __future__ import annotations
from typing import TypedDict, Required
class A(TypedDict):
x: Required[int]
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.12.4\nWhen NOT to use: This fix should not be used if the application relies on the previous behavior of deferred imports.\n\n
Why This Fix Works in Production
- Trigger: python b.py
- Mechanism: Fixes an issue with forward references in parent TypedDict classes that caused failures in Pydantic 2.12 when used with Python 3.14.
- Why the fix works: Fixes an issue with forward references in parent TypedDict classes that caused failures in Pydantic 2.12 when used with Python 3.14. (first fixed release: 2.12.4).
- If left unfixed, this can cause silent data inconsistencies that propagate (bad cache entries, incorrect downstream decisions).
Why This Breaks in Prod
- Shows up under Python 3.14 in real deployments (not just unit tests).
- Surfaces as: python b.py
Proof / Evidence
- GitHub issue: #12421
- Fix PR: https://github.com/pydantic/pydantic/pull/12427
- First fixed release: 2.12.4
- 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.40
Discussion
High-signal excerpts from the issue thread (symptoms, repros, edge-cases).
“### Initial Checks - [x] I confirm that I'm using Pydantic V2 ### Description Pydantic 2.12 fails to resolve deferred imports in Python 3.14 See the example below. Notes: * reproduced with Python 3.14.0 * not reproduced with Python 3.13.2 *”
Failure Signature (Search String)
- python b.py
Error Message
Stack trace
Error Message
-------------
python b.py
Traceback (most recent call last):
File "/private/tmp/b.py", line 10, in <module>
C.model_validate({"c": {"x": 1}})
~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
File "/Users/christophe.bornet/.pyenv/versions/3.14.0/lib/python3.14/site-packages/pydantic/main.py", line 716, in model_validate
return cls.__pydantic_validator__.validate_python(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/christophe.bornet/.pyenv/versions/3.14.0/lib/python3.14/site-packages/pydantic/_internal/_mock_val_ser.py", line 100, in __getattr__
raise PydanticUserError(self._error_message, code=self._code)
pydantic.errors.PydanticUserError: `C` is not fully defined; you should define `Required`, then call `C.model_rebuild()`.
For further information visit https://errors.pydantic.dev/2.12/u/class-not-fully-defined
Minimal Reproduction
from __future__ import annotations
from typing import TypedDict, Required
class A(TypedDict):
x: Required[int]
Environment
- Python: 3.14
- Pydantic: 2
Fix Options (Details)
Option A — Upgrade to fixed release Safe default (recommended)
pip install pydantic==2.12.4
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/12427
First fixed release: 2.12.4
Last verified: 2026-02-09. Validate in your environment.
When NOT to Use This Fix
- This fix should not be used if the application relies on the previous behavior of deferred imports.
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.12.4 | Fixed |
Related Issues
No related fixes found.
Sources
We don’t republish the full GitHub discussion text. Use the links above for context.