Jump to solution
Verify

The Fix

pip install pydantic==1.10.20

Based on closed pydantic/pydantic issue #10877 · 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
@@ -1967,12 +1967,25 @@ def _computed_field_schema( """Generate schema for an Annotated type, e.g. `Annotated[int, Field(...)]` or `Annotated[int, Gt(0)]`.""" FieldInfo = import_cached_field_info() - - source_type, *annotations = self._get_args_resolving_forward_refs( - annotated_type,
repro.py
from enum import Enum from typing import Annotated from pydantic import BaseModel from typing_extensions import Doc class MyEnum(Enum): A = "a" B = "b" type MyEnumType = Annotated[MyEnum, Doc("My enum type.")] class MyClass(BaseModel): my_attr: MyEnumType
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==1.10.20\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: class MyClass(BaseModel):
  • Mechanism: PEP 695 type aliases were not unpacked correctly when using the Annotated form in Pydantic
  • Why the fix works: Unpacks PEP 695 type aliases when using the Annotated form, resolving issues with type annotations in Pydantic. (first fixed release: 1.10.20).
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).
  • PEP 695 type aliases were not unpacked correctly when using the Annotated form in Pydantic
  • Surfaces as: /home/can/.cache/pypoetry/virtualenvs/bikipy-mu4xEx7I-py3.12/bin/python /data/can-data/Projects/bikipy/t.py

Proof / Evidence

Discussion

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

“This is fixed on main (might be because of https://github.com/pydantic/pydantic/pull/10809), and https://github.com/pydantic/pydantic/pull/11109 fixes it "officially".”
@Viicos · 2024-12-22 · confirmation · source
“Also under the scope of https://github.com/pydantic/pydantic/issues/9782”
@sydney-runkle · 2024-11-18 · source

Failure Signature (Search String)

  • class MyClass(BaseModel):

Error Message

Stack trace
error.txt
Error Message ------------- /home/can/.cache/pypoetry/virtualenvs/bikipy-mu4xEx7I-py3.12/bin/python /data/can-data/Projects/bikipy/t.py Traceback (most recent call last): File "/data/can-data/Projects/bikipy/t.py", line 16, in <module> class MyClass(BaseModel): File "/home/can/.cache/pypoetry/virtualenvs/bikipy-mu4xEx7I-py3.12/lib/python3.12/site-packages/pydantic/_internal/_model_construction.py", line 224, in __new__ complete_model_class( File "/home/can/.cache/pypoetry/virtualenvs/bikipy-mu4xEx7I-py3.12/lib/python3.12/site-packages/pydantic/_internal/_model_construction.py", line 595, in complete_model_class cls.__pydantic_validator__ = create_schema_validator( ^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/can/.cache/pypoetry/virtualenvs/bikipy-mu4xEx7I-py3.12/lib/python3.12/site-packages/pydantic/plugin/_schema_validator.py", line 50, in create_schema_validator return SchemaValidator(schema, config) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pydantic_core._pydantic_core.SchemaError: Definitions error: definition `__main__.MyEnum:888676848` was never filled

Minimal Reproduction

repro.py
from enum import Enum from typing import Annotated from pydantic import BaseModel from typing_extensions import Doc class MyEnum(Enum): A = "a" B = "b" type MyEnumType = Annotated[MyEnum, Doc("My enum type.")] class MyClass(BaseModel): my_attr: MyEnumType

Environment

  • Python: 3.12
  • Pydantic: 2

What Broke

Users experienced schema validation errors when using PEP 695 types with Enum in annotations.

Why It Broke

PEP 695 type aliases were not unpacked correctly when using the Annotated form in Pydantic

Fix Options (Details)

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

pip install pydantic==1.10.20

When NOT to use: Do not use if it changes public behavior or if the failure cannot be reproduced.

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

First fixed release: 1.10.20

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

  • Do not use if it changes public behavior or if the failure cannot be reproduced.

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

Related Issues

No related fixes found.

Sources

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