The Fix
pip install pydantic==1.10.15
Based on closed pydantic/pydantic issue #9070 · 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%.
@@ -764,7 +764,7 @@ def __getattr__(self, item: str) -> Any:
pydantic_extra = None
- if pydantic_extra is not None:
+ if pydantic_extra:
try:
from pydantic import BaseModel, ConfigDict
class MyModel(BaseModel):
@property
def my_property(self):
"""A random property."""
raise AttributeError("Original Error!")
model_config = ConfigDict(extra="allow")
my_model = MyModel()
my_model.my_property
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.15\nWhen NOT to use: This fix should not be used if the model requires strict attribute handling without allowing extra fields.\n\n
Why This Fix Works in Production
- Trigger: Unexpected error message while using properties with pydantic models
- Mechanism: Fixes an issue in Model.__getattr__() that incorrectly handles extra fields when they are empty, leading to misleading AttributeError messages.
- Why the fix works: Fixes an issue in Model.__getattr__() that incorrectly handles extra fields when they are empty, leading to misleading AttributeError messages. (first fixed release: 1.10.15).
- 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.9 in real deployments (not just unit tests).
- Production symptom (often without a traceback): Unexpected error message while using properties with pydantic models
Proof / Evidence
- GitHub issue: #9070
- Fix PR: https://github.com/pydantic/pydantic/pull/9082
- First fixed release: 1.10.15
- 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.63
Discussion
High-signal excerpts from the issue thread (symptoms, repros, edge-cases).
“@bcdurak, Huh, that's odd! Thanks for reporting. Definitely a bug. Happens when you have the computed_field decorator over said property as well, which is even…”
“@sydney-runkle I looked into this and it seems that the problem is in the Model.__getattr__() method”
Failure Signature (Search String)
- Unexpected error message while using properties with pydantic models
- I ran into an issue while using a property with a pydantic class which led to an unexpected error.
Copy-friendly signature
Failure Signature
-----------------
Unexpected error message while using properties with pydantic models
I ran into an issue while using a property with a pydantic class which led to an unexpected error.
Error Message
Signature-only (no traceback captured)
Error Message
-------------
Unexpected error message while using properties with pydantic models
I ran into an issue while using a property with a pydantic class which led to an unexpected error.
Minimal Reproduction
from pydantic import BaseModel, ConfigDict
class MyModel(BaseModel):
@property
def my_property(self):
"""A random property."""
raise AttributeError("Original Error!")
model_config = ConfigDict(extra="allow")
my_model = MyModel()
my_model.my_property
Environment
- Python: 3.9
- Pydantic: 2
What Broke
Users receive misleading AttributeError messages when accessing properties in Pydantic models.
Fix Options (Details)
Option A — Upgrade to fixed release Safe default (recommended)
pip install pydantic==1.10.15
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/9082
First fixed release: 1.10.15
Last verified: 2026-02-09. Validate in your environment.
When NOT to Use This Fix
- This fix should not be used if the model requires strict attribute handling without allowing extra fields.
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.15 | Fixed |
Related Issues
No related fixes found.
Sources
We don’t republish the full GitHub discussion text. Use the links above for context.