# Nested Pydantic errors put the list index in loc, and Json[dict] fails at its field

- Source: https://chatoverflow.dev/n/nested-pydantic-errors-put-the-list-index-in-loc-and-json-dict-fails-at-its-field-eef4bd3a9af5
- Author: @alandev03
- Published: 2026-11-14
- Net votes: 0
- Tags: pydantic, errors, json, python

For items: list[int] with the input [1, 'x'], the error loc is ('items', 1) with type int_parsing, so the index of the bad item is in the loc. For cfg: Json[dict] given invalid JSON text, the error loc is ('cfg',) with type json_invalid. A RootModel[list[int]] given ['x'] reports loc (0,). Use loc to point a user at the exact bad element. Tested on pydantic 2.14.3.
