The Fix
pip install pydantic==1.10.16
Based on closed pydantic/pydantic issue #9575 · 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%.
@@ -723,17 +723,27 @@ print(Model.model_json_schema()['properties']['deprecated_field'])
### `deprecated` via the `warnings.deprecated` decorator
+!!! note
+ You can only use the `deprecated` decorator in this way if you have
+ `typing_extensions` >= 4.9.0 installed.
from typing_extensions import Annotated, deprecated
from pydantic import BaseModel, Field
class Model(BaseModel):
deprecated_field: Annotated[int, deprecated('This is deprecated')]
# Or explicitly using `Field`:
alt_form: Annotated[int, Field(deprecated=deprecated('This is deprecated'))]
print(Model.model_json_schema()['properties']['deprecated_field'])
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.16\nWhen NOT to use: This fix is not applicable if using a version of typing_extensions lower than 4.9.\n\n
Why This Fix Works in Production
- Trigger: pydantic version: v2.7.2, pydantic-core version: v2.18.3
- Mechanism: The deprecation decorator was not functioning correctly due to a version mismatch with typing_extensions
- Why the fix works: Updated the documentation to clarify the usage of the `deprecated` decorator with a version requirement for `typing_extensions`. (first fixed release: 1.10.16).
- 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.11 in real deployments (not just unit tests).
- The deprecation decorator was not functioning correctly due to a version mismatch with typing_extensions
- Surfaces as: pydantic version: v2.7.2, pydantic-core version: v2.18.3
Proof / Evidence
- GitHub issue: #9575
- Fix PR: https://github.com/pydantic/pydantic/pull/9578
- First fixed release: 1.10.16
- 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.45
Discussion
High-signal excerpts from the issue thread (symptoms, repros, edge-cases).
“> besides, no warnings are raised whatsoever when I created the model, when I instantiated it, when I access or modified to deprecated field”
“@MarcBresson, I think you need typing_extensions >= 4.9 for this to work, I'll work on a fix for the docs.”
Failure Signature (Search String)
- pydantic version: v2.7.2, pydantic-core version: v2.18.3
Error Message
Stack trace
Error Message
-------------
pydantic version: v2.7.2, pydantic-core version: v2.18.3
Traceback (most recent call last):
File "", line 6, in
File "/lib/python3.11/site-packages/pydantic/_internal/_model_construction.py", line 215, in __new__
set_deprecated_descriptors(cls)
File "/lib/python3.11/site-packages/pydantic/_internal/_model_construction.py", line 580, in set_deprecated_descriptors
if (msg := field_info.deprecation_message) is not None:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/lib/python3.11/site-packages/pydantic/fields.py", line 530, in deprecation_message
return self.deprecated if isinstance(self.deprecated, str) else self.deprecated.message
^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'function' object has no attribute 'message'
Minimal Reproduction
from typing_extensions import Annotated, deprecated
from pydantic import BaseModel, Field
class Model(BaseModel):
deprecated_field: Annotated[int, deprecated('This is deprecated')]
# Or explicitly using `Field`:
alt_form: Annotated[int, Field(deprecated=deprecated('This is deprecated'))]
print(Model.model_json_schema()['properties']['deprecated_field'])
Environment
- Python: 3.11
- Pydantic: 2
What Broke
Users encountered AttributeError when using deprecated fields in Pydantic models.
Why It Broke
The deprecation decorator was not functioning correctly due to a version mismatch with typing_extensions
Fix Options (Details)
Option A — Upgrade to fixed release Safe default (recommended)
pip install pydantic==1.10.16
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/9578
First fixed release: 1.10.16
Last verified: 2026-02-09. Validate in your environment.
When NOT to Use This Fix
- This fix is not applicable if using a version of typing_extensions lower than 4.9.
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.16 | Fixed |
Related Issues
No related fixes found.
Sources
We don’t republish the full GitHub discussion text. Use the links above for context.