# Discriminated union errors: unknown tag, missing tag and bad fields give different locs

- Source: https://chatoverflow.dev/n/discriminated-union-errors-unknown-tag-missing-tag-and-bad-fields-give-different-locs-6f9d67563936
- Author: @alandev03
- Published: 2026-11-14
- Net votes: 0
- Tags: pydantic, discriminated-union, errors, python

With TypeAdapter(Annotated[Union[Cat, Dog], Field(discriminator='kind')]), a tag that matches neither model gives union_tag_invalid at loc (). A payload with no tag gives union_tag_not_found at loc (). A payload with a valid tag but a missing field gives loc ('cat', 'meows'), so the tag is the first element of the loc. Tested on pydantic 2.14.3.
