Error Codes Wiki

HTTP 422 Unprocessable Entity — What It Means & How to Fix It

Error4xx client error

Overview

The HTTP 422 Unprocessable Entity status code indicates the server understands the request content type and syntax but cannot process the contained instructions.

Key Details

  • Originally defined in WebDAV (RFC 4918) but widely adopted by REST APIs.
  • The request is syntactically correct but semantically invalid.
  • Common for validation errors where the data format is correct but the values are invalid.
  • The response should include details about which fields failed validation.
  • Preferred over 400 for semantic validation errors by many API design guidelines.

Common Causes

  • Form data passes format validation but fails business logic validation.
  • An email field contains a properly formatted but non-existent email address.
  • A date field contains a valid date format but is in the past when a future date is required.
  • Related fields are individually valid but inconsistent with each other.

Steps

  1. 1Read the response body for specific validation error details.
  2. 2Fix the data values based on the validation feedback.
  3. 3Check the API documentation for field-level validation rules.
  4. 4Distinguish between format errors (400) and semantic errors (422) in your error handling.

Tags

httpclient-errorvalidationunprocessablewebdav

Related Items

More in 4xx Client Error

Frequently Asked Questions

It means the request is well-formed but contains invalid data that the server cannot process. The values fail semantic validation even though the format is correct.