Jump to solution
Verify

The Fix

pip install pydantic==2.9.2

Based on closed pydantic/pydantic issue #10384 · 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
@@ -690,7 +690,7 @@ def set_deprecated_descriptors(cls: type[BaseModel]) -> None: class _DeprecatedFieldDescriptor: - """Data descriptor used to emit a runtime deprecation warning before accessing a deprecated field. + """Read-only data descriptor used to emit a runtime deprecation warning before accessing a deprecated field.
repro.py
from pydantic import BaseModel, computed_field class A(BaseModel): name: str @computed_field(deprecated=True) def resolved_name(self) -> str: return self.name.upper() class B(A): ...
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==2.9.2\nWhen NOT to use: This fix should not be applied if the model does not contain deprecated computed fields.\n\n

Why This Fix Works in Production

  • Trigger: return getattr(tp, name)
  • Mechanism: Subclassing models with deprecated computed fields caused an AttributeError during model construction
  • Why the fix works: Fix class access of deprecated computed fields to allow subclassing models with deprecated computed fields. (first fixed release: 2.9.2).
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.11 in real deployments (not just unit tests).
  • Subclassing models with deprecated computed fields caused an AttributeError during model construction
  • Surfaces as: Traceback (most recent call last):

Proof / Evidence

Discussion

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

“Thanks for the bug report, I'll work on fix.”
@Viicos · 2024-09-11 · source

Failure Signature (Search String)

  • return getattr(tp, name)

Error Message

Stack trace
error.txt
Error Message ------------- Traceback (most recent call last): File "~/.pyenv/versions/bikeshed/lib/python3.11/site-packages/pydantic/_internal/_decorators.py", line 382, in get_attribute_from_bases return getattr(tp, name) ^^^^^^^^^^^^^^^^^ File "~/.pyenv/versions/bikeshed/lib/python3.11/site-packages/pydantic/_internal/_model_construction.py", line 262, in __getattr__ raise AttributeError(item) AttributeError: resolved_name During handling of the above exception, another exception occurred: Traceback (most recent call last): File "~/example.py", line 12, in <module> class B(A): ... File "~/.pyenv/versions/bikeshed/lib/python3.11/site-packages/pydantic/_internal/_model_construction.py", line 154, in __new__ cls.__pydantic_decorators__ = DecoratorInfos.build(cls) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "~/.pyenv/versions/bikeshed/lib/python3.11/site-packages/pydantic/_internal/_decorators.py", line 450, in build res.computed_fields.update({k: v.bind_to_cls(model_dc) for k, v in existing.computed_fields.items()}) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "~/.pyenv/versions/bikeshed/lib/python3.11/site-packages/pydantic/_internal/_decorators.py", line 450, in <dictcomp> res.computed_fields.update({k: v.bind_to_cls(model_dc) for k, v in existing.computed_fields.items() ... (truncated) ...

Minimal Reproduction

repro.py
from pydantic import BaseModel, computed_field class A(BaseModel): name: str @computed_field(deprecated=True) def resolved_name(self) -> str: return self.name.upper() class B(A): ...

Environment

  • Python: 3.11
  • Pydantic: 2

What Broke

Attempting to subclass a model resulted in runtime errors, preventing proper model usage.

Why It Broke

Subclassing models with deprecated computed fields caused an AttributeError during model construction

Fix Options (Details)

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

pip install pydantic==2.9.2

When NOT to use: This fix should not be applied if the model does not contain deprecated computed fields.

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

First fixed release: 2.9.2

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

  • This fix should not be applied if the model does not contain deprecated computed fields.

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

Related Issues

No related fixes found.

Sources

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