HTTP 422 · 4XX RFC 9110 §15.5.21 Cacheable: No Retryable: No (fix input fields)

HTTP 422 Unprocessable Content: Root Causes & Production Fix Guide

HTTP 422 Unprocessable Content means the server understood the Content-Type and parsed the syntax (valid JSON), but the payload failed semantic or schema validation (e.g., invalid email, negative quantity, Zod/Pydantic error).

Top Root Causes of HTTP 422

Structured 422 Validation Error Payload (RFC 9457)

HTTP/1.1 422 Unprocessable Content
Content-Type: application/problem+json

{
  "type": "https://api.example.com/errors/validation-failed",
  "title": "Validation Failed",
  "status": 422,
  "errors": [
    { "field": "email", "message": "Must be a valid email address" },
    { "field": "quantity", "message": "Must be >= 1" }
  ]
}

Verify with cURL

curl -i -sS -X POST -H 'Content-Type: application/json' -d '{"email":"bad"}' https://api.example.com/v1/signup

Interactive Stack Diagnoser (HTTP 422)

Frequently Asked Questions

When should an API return 422 vs 400?

Return 400 when the HTTP request or JSON syntax itself is broken, and 422 when the JSON is valid but field values violate schema or business rules.

Why does FastAPI return 422 automatically?

FastAPI uses Pydantic to validate request bodies, query params, and path params, automatically emitting 422 with a `detail` array showing exact field locations.

Should frontend apps retry 422 errors?

No. Display field-level error messages to the user and fix the request payload before resubmitting.

Related Status Guides & Header Tools