Jump to solution
Verify

The Fix

pip install pydantic==1.10.15

Based on closed pydantic/pydantic issue #9107 · 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
@@ -177,7 +177,7 @@ def collect_model_fields( # noqa: C901 # when building a generic model with `MyModel[int]`, the generic_origin check makes sure we don't get - # "... shadows an attribute" errors + # "... shadows an attribute" warnings generic_origin = getattr(cls, '__pydantic_generic_metadata__', {}).get('origin')
repro.py
(venv) imacat@host ~/project % python -c "import pydantic.version; print(pydantic.version.version_info())" pydantic version: 2.6.4 pydantic-core version: 2.16.3 pydantic-core build: profile=release pgo=true install path: /home/imacat/project/venv/lib/python3.11/site-packages/pydantic python version: 3.11.2 (main, Mar 13 2023, 12:18:29) [GCC 12.2.0] platform: Linux-6.1.0-18-amd64-x86_64-with-glibc2.36 related packages: pydantic-settings-2.2.1 typing_extensions-4.10.0 fastapi-0.110.0 commit: unknown (venv) imacat@host ~/project %
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.15\nWhen NOT to use: This fix should not be applied if the field is redefined in the child class.\n\n

Why This Fix Works in Production

  • Trigger: When I put a field with an assigned default value into a separated mix-in class (for reuse), and include it in another Pydantic module, it generates the…
  • Mechanism: The warning is triggered when a field in a child class shadows a field in a parent class
  • Why the fix works: Addresses issue #9107 by adding an early exit condition to prevent warnings about shadowed fields when they are not redefined in a child class. (first fixed release: 1.10.15).
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).
  • The warning is triggered when a field in a child class shadows a field in a parent class
  • Production symptom (often without a traceback): When I put a field with an assigned default value into a separated mix-in class (for reuse), and include it in another Pydantic module, it generates the following unexpected and annoying warning.

Proof / Evidence

Discussion

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

“@imacat, Thanks for reporting”
@sydney-runkle · 2024-03-26 · confirmation · source
“@chan-vince, Any interest in this? It's related to the warning you just improved :).”
@sydney-runkle · 2024-03-26 · source
“@sydney-runkle seeing as I still had the window and file open, I have had a go..”
@chan-vince · 2024-03-26 · source
“@chan-vince, Looks great. If you could add a simple test or two with the cases you mentioned, we can merge :).”
@sydney-runkle · 2024-03-26 · source

Failure Signature (Search String)

  • When I put a field with an assigned default value into a separated mix-in class (for reuse), and include it in another Pydantic module, it generates the following unexpected and
Copy-friendly signature
signature.txt
Failure Signature ----------------- When I put a field with an assigned default value into a separated mix-in class (for reuse), and include it in another Pydantic module, it generates the following unexpected and annoying warning.

Error Message

Signature-only (no traceback captured)
error.txt
Error Message ------------- When I put a field with an assigned default value into a separated mix-in class (for reuse), and include it in another Pydantic module, it generates the following unexpected and annoying warning.

Minimal Reproduction

repro.py
(venv) imacat@host ~/project % python -c "import pydantic.version; print(pydantic.version.version_info())" pydantic version: 2.6.4 pydantic-core version: 2.16.3 pydantic-core build: profile=release pgo=true install path: /home/imacat/project/venv/lib/python3.11/site-packages/pydantic python version: 3.11.2 (main, Mar 13 2023, 12:18:29) [GCC 12.2.0] platform: Linux-6.1.0-18-amd64-x86_64-with-glibc2.36 related packages: pydantic-settings-2.2.1 typing_extensions-4.10.0 fastapi-0.110.0 commit: unknown (venv) imacat@host ~/project %

Environment

  • Python: 3.11
  • Pydantic: 2

What Broke

Users receive misleading warnings when fields are not redefined in child classes.

Why It Broke

The warning is triggered when a field in a child class shadows a field in a parent class

Fix Options (Details)

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

pip install pydantic==1.10.15

When NOT to use: This fix should not be applied if the field is redefined in the child class.

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

First fixed release: 1.10.15

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 field is redefined in the child class.

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

Related Issues

No related fixes found.

Sources

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