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%.
@@ -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')
(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 %
Re-run the minimal reproduction on your broken version, then apply the fix and re-run.
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).
- 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
- GitHub issue: #9107
- Fix PR: https://github.com/pydantic/pydantic/pull/9111
- First fixed release: 1.10.15
- Reproduced locally: No (not executed)
- Last verified: 2026-02-09
- Confidence: 0.85
- 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).
“@imacat, Thanks for reporting”
“@chan-vince, Any interest in this? It's related to the warning you just improved :).”
“@sydney-runkle seeing as I still had the window and file open, I have had a go..”
“@chan-vince, Looks great. If you could add a simple test or two with the cases you mentioned, we can merge :).”
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
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 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
(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
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.
When NOT to Use This Fix
- This fix should not be applied if the field is redefined in the child class.
Verify Fix
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
| Version | Status |
|---|---|
| 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.