Resolve request validation errors
Use a 422 response to find the invalid field and correct the request shape or value.
Updated
Read a 422 response
Threetone returns 422 Unprocessable Entity when FastAPI cannot validate request input. The response has a detail array. Each item contains:
loc: where the invalid value was found, such asbody,query, orpath, followed by the field name.msg: a human-readable explanation.type: the validation rule that failed.
Start with loc. It points to the part of the request that must change.
Correct the request
Check the following before sending it again:
- The HTTP method and
/v1/...path match the operation. - JSON requests include
Content-Type: application/jsonand contain valid JSON. - Required fields are present and field names use the documented spelling.
- Numbers, booleans, arrays, and objects use the expected JSON types.
- Enum values and query parameters satisfy the allowed values and ranges.
For example, the agent list endpoint accepts page_size values from 1 through 100. A value outside that range produces a validation error whose loc identifies query and page_size.
Do not retry the unchanged request. Fix the indicated value first, then send a new request and retain its X-Request-Id if it still fails.