Jump to solution
Verify

The Fix

pip install pydantic==2.9.0

Based on closed pydantic/pydantic issue #10284 · PR/commit linked

Jump to Verify Open PR/Commit
@@ -191,6 +191,7 @@ def validated_setattr(instance: Any, field: str, value: str, /) -> None: cls.__setattr__ = validated_setattr.__get__(None, cls) # type: ignore + cls.__pydantic_complete__ = True return True
repro.py
from pydantic.dataclasses import dataclass, rebuild_dataclass @dataclass class Point: x: float y: float color: 'Color' print(Point.__pydantic_complete__) # False: Color is not known yet print(rebuild_dataclass(Point, raise_errors=False)) # False: the dataclass can't be rebuilt # Now, we define color @dataclass class Color: name: str print(rebuild_dataclass(Point)) # True: the dataclass has been rebuilt! print(Point(x=12, y=-2, color={"name": "red"})) # Check that the dataclass works correctly # This should be True now that the dataclass has been rebuilt # However, it is still False print(Point.__pydantic_complete__)
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.0\nWhen NOT to use: This fix should not be applied if the behavior of `__pydantic_complete__` is intentionally designed to remain unchanged.\n\n

Why This Fix Works in Production

  • Trigger: print(rebuild_dataclass(Point, raise_errors=False)) # False: the dataclass can't be rebuilt
  • Mechanism: The `__pydantic_complete__` field is not updated after calling `rebuild_dataclass`
  • Why the fix works: Ensure `__pydantic_complete__` is set when rebuilding dataclasses. (first fixed release: 2.9.0).
Production impact:
  • If left unfixed, this can cause silent data inconsistencies that propagate (bad cache entries, incorrect downstream decisions).

Why This Breaks in Prod

  • Shows up under Python 3.10 in real deployments (not just unit tests).
  • The `__pydantic_complete__` field is not updated after calling `rebuild_dataclass`
  • Production symptom (often without a traceback): print(rebuild_dataclass(Point, raise_errors=False)) # False: the dataclass can't be rebuilt

Proof / Evidence

Verified Execution

We executed the runnable minimal repro in a temporary environment and captured exit codes + logs.

  • Status: PASS
  • Ran: 2026-02-11T16:52:29Z
  • Package: pydantic
  • Fixed: 2.9.0
  • Mode: fixed_only
  • Outcome: ok
Logs
affected (exit=None)
fixed (exit=0)
False False True Point(x=12.0, y=-2.0, color=Color(name='red')) True

Discussion

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

“Thanks for the bug report, pushing a fix.”
@Viicos · 2024-09-03 · source

Failure Signature (Search String)

  • print(rebuild_dataclass(Point, raise_errors=False)) # False: the dataclass can't be rebuilt
Copy-friendly signature
signature.txt
Failure Signature ----------------- print(rebuild_dataclass(Point, raise_errors=False)) # False: the dataclass can't be rebuilt

Error Message

Signature-only (no traceback captured)
error.txt
Error Message ------------- print(rebuild_dataclass(Point, raise_errors=False)) # False: the dataclass can't be rebuilt

Minimal Reproduction

repro.py
from pydantic.dataclasses import dataclass, rebuild_dataclass @dataclass class Point: x: float y: float color: 'Color' print(Point.__pydantic_complete__) # False: Color is not known yet print(rebuild_dataclass(Point, raise_errors=False)) # False: the dataclass can't be rebuilt # Now, we define color @dataclass class Color: name: str print(rebuild_dataclass(Point)) # True: the dataclass has been rebuilt! print(Point(x=12, y=-2, color={"name": "red"})) # Check that the dataclass works correctly # This should be True now that the dataclass has been rebuilt # However, it is still False print(Point.__pydantic_complete__)

Environment

  • Python: 3.10
  • Pydantic: 2

What Broke

Repeated calls to `rebuild_dataclass` unnecessarily rebuild the dataclass, impacting performance.

Why It Broke

The `__pydantic_complete__` field is not updated after calling `rebuild_dataclass`

Fix Options (Details)

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

pip install pydantic==2.9.0

When NOT to use: This fix should not be applied if the behavior of `__pydantic_complete__` is intentionally designed to remain unchanged.

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

First fixed release: 2.9.0

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 behavior of `__pydantic_complete__` is intentionally designed to remain unchanged.

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.0 Fixed

Related Issues

No related fixes found.

Sources

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