- Home
- Tools
- Developer Tools
- HTTP Status Codes
- 412 Precondition Failed
412 Precondition Failed
A condition in the request headers, such as If-Match, turned out to be false, so the server did not carry the request out.
- Class
- 4xx Client error. The request is the problem: a wrong address, missing credentials, data the server can't accept.
- Defined in
- RFC 9110
What it looks like
HTTP/1.1 412 Precondition Failed ETag: "7c1-9d2"
What causes it
When a client makes its request depend on the state of the resource and that state is different. The classic use is safe editing: the client sends the ETag of the version it loaded in If-Match, and if someone else saved in the meantime, the ETag no longer matches and the update is refused.
What to do about it
Nothing was changed. Fetch the resource again, apply your change to the new version and send it with the new ETag.
If you get a 412 without having set a condition, look for a library or a proxy that adds If-Match or If-Unmodified-Since for you. For a GET, the answer to a failed condition is 304 and not 412.
Not to be confused with
| 409 Conflict | A conflict that the server found by itself, without a condition from the client. |
|---|---|
| 428 Precondition Required | The server insists on a condition and the request had none. |
| 304 Not Modified | The outcome of a condition on a GET: use the copy you have. |
All codes are on the list of HTTP status codes, which can be searched by number and by word.
Other 4xx codes
- 400 Bad Request
- 401 Unauthorized
- 402 Payment Required
- 403 Forbidden
- 404 Not Found
- 405 Method Not Allowed
- 406 Not Acceptable
- 407 Proxy Authentication Required
- 408 Request Timeout
- 409 Conflict
- 410 Gone
- 411 Length Required
- 413 Content Too Large
- 414 URI Too Long
- 415 Unsupported Media Type
- 416 Range Not Satisfiable
- 417 Expectation Failed
- 418 I'm a teapot
- 421 Misdirected Request
- 422 Unprocessable Content
- 423 Locked
- 424 Failed Dependency
- 425 Too Early
- 426 Upgrade Required
- 428 Precondition Required
- 429 Too Many Requests
- 431 Request Header Fields Too Large
- 451 Unavailable For Legal Reasons