422 Unprocessable Content
HTTP response status code 422 Unprocessable Content is a client error returned by the server to indicate the content type is understood and the syntax is correct, but the server is unable to process the instructions specified by the request.
Usage
The 422 Unprocessable Content error indicates the server understands the request but finds the content semantically invalid. The content type is recognized (otherwise, a 415 Unsupported Media Type error is sent). The syntax is also valid (otherwise, a 400 Bad Request error is more appropriate).
An error of this type occurs when the request includes an XML instruction block as the message body, correctly formed and understood by the server, yet containing errors in logic resulting in a server-side error.
SEO impact
Search engines like Google will not index a URL with 422 Unprocessable Content response status, and consequently, URLs indexed in the past returning this HTTP status code will be removed from search results.
Example
The client uses an XML document to request starting
task #100. The XML document is recognized by the
server and syntactically correct. The server does not
have a record of a task with id=100, so the request
is not processable.
Request
POST /requests HTTP/1.1
Host: www.example.re
Content-Type: application/xml
Content-Length: 101
<?xml version="1.0" encoding="utf-8"?>
<request>
<id>100</id>
<action>start</action>
</request>
Response
HTTP/1.1 422 Unprocessable Content
Content-Type: text/html
Content-Length: 150
<html>
<head>
<title>Request Failed</title>
</head>
<body>
<p>Task #100 is not recognized.</p>
</body>
</html>
How to fix
Inspect the response body first. Most APIs and frameworks return field-level error details explaining which value failed and why. Use those messages to pinpoint the exact problem.
Validate the request body against the expected schema before sending. Common triggers include missing required fields, wrong data types (sending a string where the API expects a number), invalid email or date formats, duplicate unique values, and enum values outside the allowed set.
Confirm the Content-Type header
matches the body format. Sending JSON with a
text/plain content type leads to parsing failures
on many servers.
In Laravel, a 422 typically means form validation
rules were not satisfied. Check the errors object
in the JSON response for the failing field names and
validation messages. In Rails, failed model
validations on create or update return 422 by
default. Inspect model.errors for specifics.
For REST APIs like GitHub or Shopify, verify the request payload matches the current API version. Field names, required parameters, and accepted values change between versions.
On the server side, return structured error responses listing each invalid field, the rejected value, and the expected format. Generic "validation failed" messages force clients to guess.
Code references
.NET
HttpStatusCode.UnprocessableEntity
Rust
http::StatusCode::UNPROCESSABLE_ENTITY
Rails
:unprocessable_entity
Go
http.StatusUnprocessableEntity
Symfony
Response::HTTP_UNPROCESSABLE_ENTITY
Python3.5+
http.HTTPStatus.UNPROCESSABLE_ENTITY
Apache HttpComponents Core
org.apache.hc.core5.http.HttpStatus.SC_UNPROCESSABLE_CONTENT
// deprecated alias: SC_UNPROCESSABLE_ENTITY
Angular
@angular/common/http/HttpStatusCode.UnprocessableEntity
Takeaway
The 422 Unprocessable Content status code is a client error sent by the server to indicate the request is syntactically correct and understood, but semantically invalid.
See also
- RFC 9110: HTTP Semantics
- Google: HTTP status codes and network errors
- RFC 4918: HTTP Extensions for WebDAV
- 400
- 415
- HTTP status codes