412 Precondition Failed
4xx Client Error
RFC 9110
The conditions you set weren't met — request aborted.
What 412 Precondition Failed means {#what}
Used in conditional requests where the client sets preconditions via headers like If-Match or If-Unmodified-Since. If those conditions aren’t met (e.g., the resource was modified by someone else), the server rejects the request with 412.
When you’ll see a 412 {#when}
- Optimistic concurrency control: you fetch a resource, get its ETag, then try to update it — if it changed in the meantime, you get 412
If-Matchheader that no longer matches
When to use 412 {#use}
- Implement ETags for safe concurrent updates
- Prevents the “lost update” problem in collaborative APIs