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%.
@@ -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,
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
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==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).
- 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
- GitHub issue: #10877
- Fix PR: https://github.com/pydantic/pydantic/pull/11109
- First fixed release: 1.10.20
- Reproduced locally: No (not executed)
- Last verified: 2026-02-09
- Confidence: 0.85
- Did this fix it?: Yes (upstream fix exists)
- Own content ratio: 0.41
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".”
“Also under the scope of https://github.com/pydantic/pydantic/issues/9782”
Failure Signature (Search String)
- class MyClass(BaseModel):
Error Message
Stack trace
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
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
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.
When NOT to Use This Fix
- Do not use if it changes public behavior or if the failure cannot be reproduced.
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 |
|---|---|
| 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.