422 Unprocessable Entity

The request parsed fine — syntax is valid — but the content fails semantic validation: a missing required field, an email that isn't one, a date range that ends before it starts. The conventional split: 400 for 'could not parse', 422 for 'parsed but invalid'.

What usually causes it

  • Field validation failures (required, format, range)
  • Business-rule rejections that map to input problems
  • Type mismatches after parsing (string where number expected)

How to debug and fix it

  1. Return (and read) structured error details: which field, which rule, what was received.
  2. Client-side, surface field errors next to inputs — a 422 is user-fixable by design.
  3. Keep 422 out of authentication/permission flows; those are 401/403 regardless of payload validity.
Worth knowing: 422 came from WebDAV and was adopted by REST convention (Rails popularized it). As of RFC 9110 it is part of core HTTP semantics.

Easily confused with