The Fix
pip install pydantic==1.10.19
Based on closed pydantic/pydantic issue #10569 · PR/commit linked
@@ -1569,9 +1569,8 @@ def _generate_parameter_schema(
field = FieldInfo.from_annotated_attribute(annotation, default)
assert field.annotation is not None, 'field.annotation should not be None when generating a schema'
- source_type, annotations = field.annotation, field.metadata
with self.field_name_stack.push(name):
- schema = self._apply_annotations(source_type, annotations)
from typing import Literal, Union
import pydantic
from typing_extensions import Annotated
class Cat(pydantic.BaseModel):
type: Literal['cat'] = "cat"
food: str
class Dog(pydantic.BaseModel):
type: Literal['dog'] = "dog"
food: str
Pet = Annotated[Union[Cat, Dog], pydantic.Field(discriminator="type")]
class Test(pydantic.BaseModel):
pet: Pet
# test = Test(pet={"food": "fish"})
# raises validation error with "Unable to extract tag using discriminator 'type'" as expected
@pydantic.validate_call
def test_func(pet: Pet):
return pet
output = test_func(pet={"food": "fish"}) # Expect validation to fail here
print(type(output)) # output is of type Cat
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.19\nWhen NOT to use: Do not use this fix if the application relies on the previous validation behavior.\n\nOption C — Workaround\nis to write the discriminator explicitly in each annotation.\nWhen NOT to use: Do not use this fix if the application relies on the previous validation behavior.\n\n
Why This Fix Works in Production
- Trigger: In [2]: test_func(pet={"food": "fish", "type": "cat"})
- Mechanism: The `validate_call` function does not properly handle discriminated unions in `Annotated` types
- Why the fix works: Fixes the issue where `validate_call` ignores the `Field` in `Annotated` types, specifically for discriminated unions. (first fixed release: 1.10.19).
Why This Breaks in Prod
- Shows up under Python 3.8 in real deployments (not just unit tests).
- The `validate_call` function does not properly handle discriminated unions in `Annotated` types
- Surfaces as: In [2]: test_func(pet={"food": "fish", "type": "cat"})
Proof / Evidence
- GitHub issue: #10569
- Fix PR: https://github.com/pydantic/pydantic/pull/10610
- First fixed release: 1.10.19
- 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.32
Discussion
High-signal excerpts from the issue thread (symptoms, repros, edge-cases).
“I believe your usage is correct and the underlying issue might be related to #10482. A possible workaround is to write the discriminator explicitly in…”
“Huh, very odd. Definitely misbehavior. Thanks for reporting this bug!”
Failure Signature (Search String)
- In [2]: test_func(pet={"food": "fish", "type": "cat"})
Error Message
Stack trace
Error Message
-------------
In [2]: test_func(pet={"food": "fish", "type": "cat"})
Out[2]: Cat(type='cat', food='fish')
In [3]: test_func(pet={"food": "fish", "type": "dog"})
Out[3]: Dog(type='dog', food='fish')
In [4]: test_func(pet={"food": "fish", "type": "dragon"})
ValidationError: 2 validation errors for test_func
pet.tagged-union[Cat]
Input tag 'dragon' found using 'type' does not match any of the expected tags: 'cat' [type=union_tag_invalid, input_value={'food': 'fish', 'type': 'dragon'}, input_type=dict]
For further information visit https://errors.pydantic.dev/2.8/v/union_tag_invalid
pet.tagged-union[Dog]
Input tag 'dragon' found using 'type' does not match any of the expected tags: 'dog' [type=union_tag_invalid, input_value={'food': 'fish', 'type': 'dragon'}, input_type=dict]
For further information visit https://errors.pydantic.dev/2.8/v/union_tag_invalid
In [5]: test_func(pet={"food": "fish"})
ValidationError: 2 validation errors for test_func
pet.tagged-union[Cat]
Unable to extract tag using discriminator 'type' [type=union_tag_not_found, input_value={'food': 'fish'}, input_type=dict]
For further information visit https://errors.pydantic.dev/2.8/v/union_tag_not_found
pet.tagged-union[Dog]
Unable to extract tag using discriminator 'type' [type=union_tag_not_found, input_value={'food': 'fish'}, input_type=dict]
For further information visit https://errors.pydantic.dev/
... (truncated) ...
Minimal Reproduction
from typing import Literal, Union
import pydantic
from typing_extensions import Annotated
class Cat(pydantic.BaseModel):
type: Literal['cat'] = "cat"
food: str
class Dog(pydantic.BaseModel):
type: Literal['dog'] = "dog"
food: str
Pet = Annotated[Union[Cat, Dog], pydantic.Field(discriminator="type")]
class Test(pydantic.BaseModel):
pet: Pet
# test = Test(pet={"food": "fish"})
# raises validation error with "Unable to extract tag using discriminator 'type'" as expected
@pydantic.validate_call
def test_func(pet: Pet):
return pet
output = test_func(pet={"food": "fish"}) # Expect validation to fail here
print(type(output)) # output is of type Cat
Environment
- Python: 3.8
- Pydantic: 2
What Broke
Validation fails unexpectedly, allowing incorrect types to pass through.
Why It Broke
The `validate_call` function does not properly handle discriminated unions in `Annotated` types
Fix Options (Details)
Option A — Upgrade to fixed release Safe default (recommended)
pip install pydantic==1.10.19
Use when you can deploy the upstream fix. It is usually lower-risk than long-lived workarounds.
Option C — Workaround Temporary workaround
is to write the discriminator explicitly in each annotation.
Use only if you cannot change versions today. Treat this as a stopgap and remove once upgraded.
Fix reference: https://github.com/pydantic/pydantic/pull/10610
First fixed release: 1.10.19
Last verified: 2026-02-09. Validate in your environment.
When NOT to Use This Fix
- Do not use this fix if the application relies on the previous validation behavior.
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.19 | Fixed |
Related Issues
No related fixes found.
Sources
We don’t republish the full GitHub discussion text. Use the links above for context.