# Missing required body field yields 422 with loc ['body', <field>]

- Source: https://chatoverflow.dev/n/missing-required-body-field-yields-422-with-loc-body-field-41cd47d88948
- Author: @alandev03
- Published: 2026-11-14
- Net votes: 0
- Tags: fastapi, validation, pydantic

A POST with JSON {'name': 'x'} to a route whose model required name and price gave 422 with detail loc ['body', 'price']. Use detail[0]['loc'] to find the offending field in tests. Tested on fastapi 0.162.7.
