The Fix
pip install pydantic==1.10.18
Based on closed pydantic/pydantic issue #9872 · 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%.
@@ -80,7 +80,7 @@
from ._schema_generation_shared import CallbackGetCoreSchemaHandler
from ._typing_extra import is_finalvar, is_self_type, is_zoneinfo_type
-from ._utils import lenient_issubclass
+from ._utils import lenient_issubclass, smart_deepcopy
pydantic version: 2.8.2
pydantic-core version: 2.20.1
pydantic-core build: profile=release pgo=true
install path: /Users/willholloway/.pyenv/versions/3.11.4/envs/medra/lib/python3.11/site-packages/pydantic
python version: 3.11.4 (main, Jan 5 2024, 18:07:48) [Clang 15.0.0 (clang-1500.1.0.2.5)]
platform: macOS-14.2.1-arm64-arm-64bit
related packages: pyright-1.1.369 typing_extensions-4.8.0 fastapi-0.104.1
commit: unknown
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.18\nWhen NOT to use: This fix should not be used if the discriminator is not properly defined in the union models.\n\n
Why This Fix Works in Production
- Trigger: Union discrimination ignored in Sequence validation
- Mechanism: The annotation `Sequence` ignores `discriminator` metadata in certain cases, leading to incorrect validation errors
- Why the fix works: Fixes a bug where the annotation `Sequence` ignores `discriminator` metadata in certain cases, leading to incorrect validation errors. (first fixed release: 1.10.18).
- 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 annotation `Sequence` ignores `discriminator` metadata in certain cases, leading to incorrect validation errors
- Production symptom (often without a traceback): Union discrimination ignored in Sequence validation
Proof / Evidence
- GitHub issue: #9872
- Fix PR: https://github.com/pydantic/pydantic/pull/9980
- First fixed release: 1.10.18
- 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.56
Discussion
High-signal excerpts from the issue thread (symptoms, repros, edge-cases).
“Confirmed, this is definitely a bug. Good catch!”
“Ah, problem is with the schema gen, the python schema doesn't get transformed to have a tagged-union:”
“Cool first issue for someone to work on, if they're interested in diving into schema building!”
Failure Signature (Search String)
- Union discrimination ignored in Sequence validation
- When validating a sequence of a discriminated union type the discrimination is ignored and validation errors are raised for "missing" fields from the other union cases.
Copy-friendly signature
Failure Signature
-----------------
Union discrimination ignored in Sequence validation
When validating a sequence of a discriminated union type the discrimination is ignored and validation errors are raised for "missing" fields from the other union cases.
Error Message
Signature-only (no traceback captured)
Error Message
-------------
Union discrimination ignored in Sequence validation
When validating a sequence of a discriminated union type the discrimination is ignored and validation errors are raised for "missing" fields from the other union cases.
Minimal Reproduction
pydantic version: 2.8.2
pydantic-core version: 2.20.1
pydantic-core build: profile=release pgo=true
install path: /Users/willholloway/.pyenv/versions/3.11.4/envs/medra/lib/python3.11/site-packages/pydantic
python version: 3.11.4 (main, Jan 5 2024, 18:07:48) [Clang 15.0.0 (clang-1500.1.0.2.5)]
platform: macOS-14.2.1-arm64-arm-64bit
related packages: pyright-1.1.369 typing_extensions-4.8.0 fastapi-0.104.1
commit: unknown
Environment
- Python: 3.11
- Pydantic: 2
What Broke
Validation errors are raised for missing fields from other union cases during sequence validation.
Why It Broke
The annotation `Sequence` ignores `discriminator` metadata in certain cases, leading to incorrect validation errors
Fix Options (Details)
Option A — Upgrade to fixed release Safe default (recommended)
pip install pydantic==1.10.18
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/9980
First fixed release: 1.10.18
Last verified: 2026-02-09. Validate in your environment.
When NOT to Use This Fix
- This fix should not be used if the discriminator is not properly defined in the union models.
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.18 | Fixed |
Related Issues
No related fixes found.
Sources
We don’t republish the full GitHub discussion text. Use the links above for context.