Jump to solution
Verify

The Fix

pip install pydantic==2.10.2

Based on closed pydantic/pydantic issue #10970 · 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
@@ -871,10 +871,6 @@ def __deepcopy__(self, memo: dict[int, Any] | None = None) -> Self: return m - def __replace__(self, **changes: Any) -> Self: - """Creates a new instance of the model, replacing fields with values from changes. Relevant for v3.13+.""" - return self.model_copy(update=changes)
repro.py
Signature of "__replace__" incompatible with supertype "BaseModel" Superclass: def __replace__(self, **changes: Any) -> Pets Subclass: def __replace__(*, root: list[str] = ...) -> Pets
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.10.2\nWhen NOT to use: Do not apply this fix if your project relies on the original `__replace__` behavior of `BaseModel`.\n\n

Why This Fix Works in Production

  • Trigger: Signature of "__replace__" incompatible - RootModel
  • Mechanism: The `__replace__` method in `RootModel` conflicts with the superclass `BaseModel` due to differing signatures
  • Why the fix works: Hides the `BaseModel.__replace__` definition from type checkers to resolve compatibility issues with mypy and the Pydantic plugin. (first fixed release: 2.10.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.13 in real deployments (not just unit tests).
  • The `__replace__` method in `RootModel` conflicts with the superclass `BaseModel` due to differing signatures
  • Production symptom (often without a traceback): Signature of "__replace__" incompatible - RootModel

Proof / Evidence

Discussion

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

“Closely related: https://github.com/pydantic/pydantic/issues/10699 I'm not able to repro this issue with https://docs.pydantic.dev/latest/concepts/models/#rootmodel-and-custom-root-types however. Do you have a MRE available?”
@Viicos · 2024-11-25 · repro detail · source
“Thanks for the clear repro steps. I'm now able to reproduce, and will investigate tomorrow.”
@Viicos · 2024-11-25 · repro detail · source
“EDIT: ~~I can try to create one, yes~~ I created a repo here https://github.com/jorgebodega/pydantic-10970, and tested it with a friend and also has the problem”
@jorgebodega · 2024-11-25 · source
“If the core issue is specific to RootModel, perhaps consider updating the title of the issue.”
@mpkocher · 2024-11-26 · source

Failure Signature (Search String)

  • Signature of "__replace__" incompatible - RootModel
  • It's raising an error like this:
Copy-friendly signature
signature.txt
Failure Signature ----------------- Signature of "__replace__" incompatible - RootModel It's raising an error like this:

Error Message

Signature-only (no traceback captured)
error.txt
Error Message ------------- Signature of "__replace__" incompatible - RootModel It's raising an error like this:

Minimal Reproduction

repro.py
Signature of "__replace__" incompatible with supertype "BaseModel" Superclass: def __replace__(self, **changes: Any) -> Pets Subclass: def __replace__(*, root: list[str] = ...) -> Pets

Environment

  • Python: 3.13
  • Pydantic: 2

What Broke

Type checking fails with mypy, causing development delays and potential integration issues.

Why It Broke

The `__replace__` method in `RootModel` conflicts with the superclass `BaseModel` due to differing signatures

Fix Options (Details)

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

pip install pydantic==2.10.2

When NOT to use: Do not apply this fix if your project relies on the original `__replace__` behavior of `BaseModel`.

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

First fixed release: 2.10.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

  • Do not apply this fix if your project relies on the original `__replace__` behavior of `BaseModel`.

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

Related Issues

No related fixes found.

Sources

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