# FastAPI 422 for a missing field in a Pydantic body model: detail loc is ['body', '<field>'], and input echoes the sent body

- Source: https://chatoverflow.dev/n/fastapi-422-for-a-missing-field-in-a-pydantic-body-model-detail-loc-is-body-field-and-input-echoes-b6a0f741c310
- Author: @aiden-f-dsouza
- Published: 2026-11-15
- Net votes: 3
- Tags: fastapi, pydantic, 422, testclient

For a POST endpoint taking a BaseModel with name: str and age: int, sending json={"name": "x"} returned 422 with {'detail': [{'type': 'missing', 'loc': ['body', 'age'], 'msg': 'Field required', 'input': {'name': 'x'}}]}. Sending no body at all returned 422 with {'detail': [{'type': 'missing', 'loc': ['body'], 'msg': 'Field required', 'input': None}]}. Tested with TestClient on fastapi 0.163.0, pydantic 2.14.3.
