Jump to solution
Verify

The Fix

pip install pydantic==1.10.19

Based on closed pydantic/pydantic issue #10772 · 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
@@ -8,6 +8,7 @@ import warnings from copy import copy, deepcopy +from functools import cached_property from typing import ( TYPE_CHECKING,
repro.py
from pydantic import ( BaseModel, ConfigDict, Field, computed_field, field_serializer, model_validator, ) @dataclass class CreateCouponInput: user_id: str coupon_id: str amount: int @computed_field(return_type=int) @functools.cached_property def sss(self): return "haha" c = CreateCouponInput(user_id="1", coupon_id="2", amount=3) c.sss = 2
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==1.10.19\nWhen NOT to use: This fix should not be used if the model relies on strict property behavior.\n\n

Why This Fix Works in Production

  • Trigger: `cached_property` cannot be assigned by recommended way
  • Mechanism: The `cached_property` does not control attribute assignment behavior in Pydantic models
  • Why the fix works: Ensures that `cached_property` can be set on Pydantic models, addressing the issue where assignment was not working as expected. (first fixed release: 1.10.19).
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.10 in real deployments (not just unit tests).
  • The `cached_property` does not control attribute assignment behavior in Pydantic models
  • Production symptom (often without a traceback): `cached_property` cannot be assigned by recommended way

Proof / Evidence

Discussion

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

“Indeed, this is annoying”
@Viicos · 2024-11-06 · source

Failure Signature (Search String)

  • `cached_property` cannot be assigned by recommended way
Copy-friendly signature
signature.txt
Failure Signature ----------------- `cached_property` cannot be assigned by recommended way

Error Message

Signature-only (no traceback captured)
error.txt
Error Message ------------- `cached_property` cannot be assigned by recommended way

Minimal Reproduction

repro.py
from pydantic import ( BaseModel, ConfigDict, Field, computed_field, field_serializer, model_validator, ) @dataclass class CreateCouponInput: user_id: str coupon_id: str amount: int @computed_field(return_type=int) @functools.cached_property def sss(self): return "haha" c = CreateCouponInput(user_id="1", coupon_id="2", amount=3) c.sss = 2

Environment

  • Python: 3.10
  • Pydantic: 2

What Broke

Attempting to assign a value to a `cached_property` results in an AttributeError.

Why It Broke

The `cached_property` does not control attribute assignment behavior in Pydantic models

Fix Options (Details)

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

pip install pydantic==1.10.19

When NOT to use: This fix should not be used if the model relies on strict property behavior.

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

First fixed release: 1.10.19

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 used if the model relies on strict property behavior.

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

Related Issues

No related fixes found.

Sources

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