Jump to solution
Verify

The Fix

pip install pydantic==2.10.3

Based on closed pydantic/pydantic issue #11004 · 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,13 +63,14 @@ def __get_pydantic_core_schema__(self, source_type: Any, handler: GetCoreSchemaH """ schema = handler(source_type) - globalns, localns = handler._get_types_namespace() try: + # Do not pass in globals as the function could be defined in a different module.
repro.py
# File b from __future__ import annotations # Deleting this will fix the issue. It was OK to use it before Pydantic 2.10.0 from typing import Annotated, Any from pydantic import PlainSerializer def serializer(value:Any) -> Any: return value Something = Annotated[Any, PlainSerializer(serializer)]
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.3\nWhen NOT to use: This fix should not be used if the code relies on future annotations for other functionalities.\n\n

Why This Fix Works in Production

  • Trigger: Model(something=1)
  • Mechanism: Fixes the issue where the Model is not fully defined when using from __future__ import annotations in Pydantic 2.10.x.
  • Why the fix works: Fixes the issue where the Model is not fully defined when using from __future__ import annotations in Pydantic 2.10.x. (first fixed release: 2.10.3).
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 in real deployments (not just unit tests).
  • Surfaces as: Traceback (most recent call last):

Proof / Evidence

Discussion

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

“Thanks for the bug report, this was an oversight in https://github.com/pydantic/pydantic/pull/10929. I will provide a fix for the next patch release.”
@Viicos · 2024-11-29 · source
“I tried the new Pydantic release that includes fix for this issue and I can confirm it solves the issue. Thank you very much for…”
@Pijukatel · 2024-12-05 · source

Failure Signature (Search String)

  • Model(something=1)

Error Message

Stack trace
error.txt
Error Message ------------- Traceback (most recent call last): File "...b.py", line 9, in <module> Model(something=1) File ".../lib/python3.12/site-packages/pydantic/main.py", line 214, in __init__ validated_self = self.__pydantic_validator__.validate_python(data, self_instance=self) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File ".../lib/python3.12/site-packages/pydantic/_internal/_mock_val_ser.py", line 100, in __getattr__ raise PydanticUserError(self._error_message, code=self._code) pydantic.errors.PydanticUserError: `Model` is not fully defined; you should define `Any`, then call `Model.model_rebuild()`. For further information visit https://errors.pydantic.dev/2.10/u/class-not-fully-defined

Minimal Reproduction

repro.py
# File b from __future__ import annotations # Deleting this will fix the issue. It was OK to use it before Pydantic 2.10.0 from typing import Annotated, Any from pydantic import PlainSerializer def serializer(value:Any) -> Any: return value Something = Annotated[Any, PlainSerializer(serializer)]

Environment

  • Python: 3.12
  • Pydantic: 2

What Broke

Users encounter PydanticUserError indicating the Model is not fully defined.

Fix Options (Details)

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

pip install pydantic==2.10.3

When NOT to use: This fix should not be used if the code relies on future annotations for other functionalities.

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

First fixed release: 2.10.3

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 code relies on future annotations for other functionalities.

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

Related Issues

No related fixes found.

Sources

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