The Fix
pip install pydantic==2.11.0
Based on closed pydantic/pydantic issue #11390 · PR/commit linked
@@ -17,7 +17,7 @@
from pydantic.errors import PydanticUserError
-from . import _typing_extra
+from . import _generics, _typing_extra
from ._config import ConfigWrapper
from pydantic import BaseModel
from typing import Annotated
from typing_extensions import deprecated
class Model(BaseModel):
a: Annotated[int, deprecated('test')] = 1
b: "Annotated[Test, deprecated('test')]" = 2
Test = int
Model.model_rebuild()
Model.model_fields['b'].deprecated == 'test'
# False, should be True
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.11.0\nWhen NOT to use: This fix should not be used if the model relies on incomplete field evaluations.\n\n
Why This Fix Works in Production
- Trigger: Model fields did not reflect deprecation warnings, leading to unexpected behavior in production.
- Mechanism: The model fields were inaccurate due to issues with evaluating forward annotations during model rebuilding
- Why the fix works: Fixes bugs related to deprecated fields with forward annotations in Pydantic models, ensuring accurate field collection during model rebuilding. (first fixed release: 2.11.0).
- If left unfixed, this can cause silent data inconsistencies that propagate (bad cache entries, incorrect downstream decisions).
Why This Breaks in Prod
- The model fields were inaccurate due to issues with evaluating forward annotations during model rebuilding
- Production symptom (often without a traceback): Model fields did not reflect deprecation warnings, leading to unexpected behavior in production.
Proof / Evidence
- GitHub issue: #11390
- Fix PR: https://github.com/pydantic/pydantic/pull/11388
- First fixed release: 2.11.0
- 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.68
Discussion
High-signal excerpts from the issue thread (symptoms, repros, edge-cases).
“First bug: By fixing the first bug, second bug:”
Failure Signature (Search String)
- Model fields did not reflect deprecation warnings, leading to unexpected behavior in production.
Copy-friendly signature
Failure Signature
-----------------
Model fields did not reflect deprecation warnings, leading to unexpected behavior in production.
Error Message
Signature-only (no traceback captured)
Error Message
-------------
Model fields did not reflect deprecation warnings, leading to unexpected behavior in production.
Minimal Reproduction
from pydantic import BaseModel
from typing import Annotated
from typing_extensions import deprecated
class Model(BaseModel):
a: Annotated[int, deprecated('test')] = 1
b: "Annotated[Test, deprecated('test')]" = 2
Test = int
Model.model_rebuild()
Model.model_fields['b'].deprecated == 'test'
# False, should be True
What Broke
Model fields did not reflect deprecation warnings, leading to unexpected behavior in production.
Why It Broke
The model fields were inaccurate due to issues with evaluating forward annotations during model rebuilding
Fix Options (Details)
Option A — Upgrade to fixed release Safe default (recommended)
pip install pydantic==2.11.0
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/11388
First fixed release: 2.11.0
Last verified: 2026-02-09. Validate in your environment.
When NOT to Use This Fix
- This fix should not be used if the model relies on incomplete field evaluations.
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.11.0 | Fixed |
Related Issues
No related fixes found.
Sources
We don’t republish the full GitHub discussion text. Use the links above for context.