Jump to solution
Verify

The Fix

pip install pydantic==2.7.2

Based on closed pydantic/pydantic issue #9461 · 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
@@ -480,7 +480,8 @@ def transform(self) -> bool: is_settings = any(base.fullname == BASESETTINGS_FULLNAME for base in info.mro[:-1]) self.add_initializer(fields, config, is_settings, is_root_model) - self.add_model_construct_method(fields, config, is_settings) + if not is_root_model: + self.add_model_construct_method(fields, config, is_settings)
repro.py
import pydantic class MyRootModel(pydantic.RootModel[str]): pass if __name__ == '__main__': reveal_type(MyRootModel) reveal_type(MyRootModel.model_construct('yo'))
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.7.2\nWhen NOT to use: This fix should not be used if the behavior of `RootModel` is expected to change significantly.\n\n

Why This Fix Works in Production

  • Trigger: error: Missing named argument "root" for "model_construct" of "MyRootModel" [call-arg] error: Argument 1 to "model_construct" of "MyRootModel" has…
  • Mechanism: Adjusts the signature handling of `RootModel.model_construct` in the mypy plugin to avoid type checking issues.
  • Why the fix works: Adjusts the signature handling of `RootModel.model_construct` in the mypy plugin to avoid type checking issues. (first fixed release: 2.7.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

  • Triggered by an upgrade/regression window: 1.2.0 breaks; 2.7.2 is the first fixed release.
  • Surfaces as: error: Missing named argument "root" for "model_construct" of "MyRootModel" [call-arg]\nerror: Argument 1 to "model_construct" of "MyRootModel" has incompatible type "str";…

Proof / Evidence

  • GitHub issue: #9461
  • Fix PR: https://github.com/pydantic/pydantic/pull/9480
  • First fixed release: 2.7.2
  • Affected versions: 1.2.0
  • Reproduced locally: No (not executed)
  • Last verified: 2026-02-09
  • Confidence: 0.95
  • Did this fix it?: Yes (upstream fix exists)
  • Own content ratio: 0.53

Discussion

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

“Ok great, at least we were able to understand where it was coming from.”
@Viicos · 2024-05-21 · source
“I'm not able to reproduce, could you please throw a reveal_type(my_root_model) in your snippet to see the actual type?”
@Viicos · 2024-05-21 · source
“mypy 1.2.0 is pretty old, do you get the same error on latest (currently 1.10.0)?”
@Viicos · 2024-05-21 · source
“yes i actually tried this on 1.10 directly, after realizing i was on 1.2”
@ornariece · 2024-05-21 · source

Failure Signature (Search String)

  • error: Missing named argument "root" for "model_construct" of "MyRootModel" [call-arg]\nerror: Argument 1 to "model_construct" of "MyRootModel" has incompatible type "str";

Error Message

Stack trace
error.txt
Error Message ------------- error: Missing named argument "root" for "model_construct" of "MyRootModel" [call-arg]\nerror: Argument 1 to "model_construct" of "MyRootModel" has incompatible type "str"; expected "Optional[Set[str]]" [arg-type]
Stack trace
error.txt
Error Message ------------- error: Missing named argument "root" for "model_construct" of "MyRootModel" [call-arg]
Stack trace
error.txt
Error Message ------------- error: Argument 1 to "model_construct" of "MyRootModel" has incompatible type "str"; expected "set[str] | None" [arg-type]

Minimal Reproduction

repro.py
import pydantic class MyRootModel(pydantic.RootModel[str]): pass if __name__ == '__main__': reveal_type(MyRootModel) reveal_type(MyRootModel.model_construct('yo'))

Environment

  • Pydantic: 2

What Broke

Type checking fails in mypy, leading to errors during development and testing.

Fix Options (Details)

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

pip install pydantic==2.7.2

When NOT to use: This fix should not be used if the behavior of `RootModel` is expected to change significantly.

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

First fixed release: 2.7.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 used if the behavior of `RootModel` is expected to change significantly.

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.2.0 Broken
2.7.2 Fixed

Related Issues

No related fixes found.

Sources

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