HTTP 412 Precondition Failed — What It Means
What HTTP status code 412 Precondition Failed means, when servers return it, and how to handle it correctly.
Published September 24, 2026
HTTP 412 Precondition Failed means a condition in the request headers (If-Match, If-Unmodified-Since) evaluated to false on the server.
What it means
It prevents lost updates: the client only updates if the resource still has the ETag it last saw.
Common causes: If-Match ETag no longer matches; Resource changed since last read; Optimistic concurrency checks.
On the wire
PUT /docs/7 HTTP/1.1
HTTP/1.1 412 Precondition Failed
If-Match: "v3"
Practical examples
Test it from the shell
curl -i https://example.com/path # look for HTTP 412Handling 412 in code or config
if (req.get('If-Match') !== etag) return res.sendStatus(412)How to fix it
Reload the resource and get the new ETag; Retry with fresh preconditions; Merge changes.
1. Reproduce: curl -i <url>
2. Confirm the status is 412
3. Apply the fix above and re-testCommon mistakes
- Reload the resource and get the new ETag
- Retry with fresh preconditions
- Ignoring the response headers that explain the details.
Key takeaways
- 412 means Precondition Failed.
- HTTP 412 Precondition Failed means a condition in the request headers (If-Match, If-Unmodified-Since) evaluated to false on the server.
- Read the response headers and logs for the exact cause.
FAQ
412 vs 409?
412 comes from explicit precondition headers; 409 from general state conflicts.
Is 412 a client or server error?
It is a client error status code, in the 4xx class.