HTTP 422 Unprocessable Entity — What It Means & How to Fix It
About HTTP 422 Unprocessable Entity
The HTTP 422 Unprocessable Entity status code indicates the server understands the request content type and syntax but cannot process the contained instructions. This guide covers everything you need to know about this topic, including common causes, step-by-step solutions, and answers to frequently asked questions.
Here are the key things to understand: 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.. Understanding these fundamentals will help you diagnose and resolve this issue more effectively.
The most common reasons this occurs include: 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.. Identifying the root cause is the first step toward finding the right solution.
To resolve this, follow these recommended steps: Read the response body for specific validation error details.. Fix the data values based on the validation feedback.. Check the API documentation for field-level validation rules.. Distinguish between format errors (400) and semantic errors (422) in your error handling.. If these steps do not resolve the issue, consider consulting additional resources or a qualified professional.
This article is part of our HTTP Status Codes collection on Error Codes Wiki. We provide comprehensive, up-to-date information to help you find solutions quickly.
Quick Answer
What does HTTP 422 mean?
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.
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
- 1Read the response body for specific validation error details.
- 2Fix the data values based on the validation feedback.
- 3Check the API documentation for field-level validation rules.
- 4Distinguish between format errors (400) and semantic errors (422) in your error handling.