Jump to solution
Verify

The Fix

pip install pydantic==1.10.18

Based on closed pydantic/pydantic issue #9936 · 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
@@ -308,6 +308,9 @@ def from_attributes_callback(ctx: MethodContext) -> Type: if pydantic_metadata is None: return ctx.default_return_type + if not any(base.fullname == BASEMODEL_FULLNAME for base in model_type.type.mro): + # not a Pydantic v2 model + return ctx.default_return_type
repro.py
from dataclasses import dataclass from typing import Optional from pydantic import BaseModel, ConfigDict from pydantic.v1 import BaseModel as BaseModelV1 @dataclass class CustomObject: x: int y: Optional[int] obj = CustomObject(x=1, y=2) class CustomModel(BaseModel): model_config = ConfigDict( from_attributes=True, strict=True, ) x: int cm = CustomModel.from_orm(obj) class CustomModelBadConfig(BaseModel): model_config = ConfigDict( strict=True, ) x: int cmnc = CustomModelBadConfig.from_orm(obj) # should be a mypy error: "CustomModelBadConfig" does not have from_attributes=True [pydantic-orm] class CustomV1Model(BaseModelV1): class Config: orm_mode = True x: int cmv1 = CustomV1Model.from_orm(obj) # shouldn't be an error but gives: "CustomV1Model" does not have from_attributes=True [pydantic-orm]
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.18\nWhen NOT to use: This fix should not be applied if the deprecated decorator issue is unresolved.\n\n

Why This Fix Works in Production

  • Trigger: pydantic.mypy `from_attributes` config check does not work with deprecated `.from_orm()` and gives false positives for `v1.BaseModel`
  • Mechanism: Fixes false positives on v1 models in the mypy plugin for the from_orm check requiring from_attributes=True config.
  • Why the fix works: Fixes false positives on v1 models in the mypy plugin for the from_orm check requiring from_attributes=True config. (first fixed release: 1.10.18).
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).
  • Production symptom (often without a traceback): pydantic.mypy `from_attributes` config check does not work with deprecated `.from_orm()` and gives false positives for `v1.BaseModel`

Proof / Evidence

Discussion

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

“Added a PR https://github.com/pydantic/pydantic/pull/9938 with described changes, the decorator issue still remains.”
@radekwlsk · 2024-07-22 · source
“@sydney-runkle Would be worth splitting it into the @deprecation bug causing false negatives for pydantic-orm error and the one with fix PR for false positives…”
@radekwlsk · 2024-07-23 · source
“I also wonder if the from_attributes check is in good place, as it is only checked for True and never used”
@radekwlsk · 2024-07-23 · source

Failure Signature (Search String)

  • pydantic.mypy `from_attributes` config check does not work with deprecated `.from_orm()` and gives false positives for `v1.BaseModel`
  • `pydantic.mypy.PydanticPlugin.get_method_hook` that is supposed to run `pydantic.mypy.from_attributes_callback` for each `from_orm` invocation does not work with
Copy-friendly signature
signature.txt
Failure Signature ----------------- pydantic.mypy `from_attributes` config check does not work with deprecated `.from_orm()` and gives false positives for `v1.BaseModel` `pydantic.mypy.PydanticPlugin.get_method_hook` that is supposed to run `pydantic.mypy.from_attributes_callback` for each `from_orm` invocation does not work with `@typing_extensions.deprecated` on `pydantic.main.BaseModel.from_orm`.

Error Message

Signature-only (no traceback captured)
error.txt
Error Message ------------- pydantic.mypy `from_attributes` config check does not work with deprecated `.from_orm()` and gives false positives for `v1.BaseModel` `pydantic.mypy.PydanticPlugin.get_method_hook` that is supposed to run `pydantic.mypy.from_attributes_callback` for each `from_orm` invocation does not work with `@typing_extensions.deprecated` on `pydantic.main.BaseModel.from_orm`.

Minimal Reproduction

repro.py
from dataclasses import dataclass from typing import Optional from pydantic import BaseModel, ConfigDict from pydantic.v1 import BaseModel as BaseModelV1 @dataclass class CustomObject: x: int y: Optional[int] obj = CustomObject(x=1, y=2) class CustomModel(BaseModel): model_config = ConfigDict( from_attributes=True, strict=True, ) x: int cm = CustomModel.from_orm(obj) class CustomModelBadConfig(BaseModel): model_config = ConfigDict( strict=True, ) x: int cmnc = CustomModelBadConfig.from_orm(obj) # should be a mypy error: "CustomModelBadConfig" does not have from_attributes=True [pydantic-orm] class CustomV1Model(BaseModelV1): class Config: orm_mode = True x: int cmv1 = CustomV1Model.from_orm(obj) # shouldn't be an error but gives: "CustomV1Model" does not have from_attributes=True [pydantic-orm]

Environment

  • Python: 3.11
  • Pydantic: 2

Fix Options (Details)

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

pip install pydantic==1.10.18

When NOT to use: This fix should not be applied if the deprecated decorator issue is unresolved.

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

First fixed release: 1.10.18

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 deprecated decorator issue is unresolved.

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

Related Issues

No related fixes found.

Sources

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