HTTP 412 — Precondition Failed
HTTP 412
Precondition Failed
A condition the client attached to the request was not true, so the server did nothing.
What 412 actually means
The client said "only do this if…" using `If-Match`, `If-Unmodified-Since` or `If-None-Match`, and the condition turned out false. It is the safety mechanism behind optimistic concurrency: you send the ETag of the version you edited, and if someone else has changed the resource in the meantime, the server refuses rather than overwriting their work. Importantly, nothing was modified — a 412 is always a clean no-op.
Common causes
- An `If-Match` ETag that no longer matches the current version
- An `If-Unmodified-Since` date earlier than the resource's last change
- A conditional PUT losing a race with another writer
- A cache revalidating against an ETag that changed
If you're just trying to view the page
- Reload to fetch the latest version and reapply your change
- If a sync client keeps failing this way, force a full refresh of its local copy
If it's your site
- This is the expected outcome of a concurrency check, not a bug — handle it by re-fetching and retrying, or by showing the user a merge
- Make sure ETags are stable across your server fleet; inconsistent ETags cause spurious 412s behind load balancers
- Distinguish it from 409 in your API: 412 means the client's explicit precondition failed, 409 means state conflicts more generally
Reference
- Status code
- 412
- Reason phrase
- Precondition Failed
- Category
- 4xx — Client Error
- Defined in
- RFC 9110 §15.5.13
Common questions
- What does HTTP 412 mean?
- A condition the client attached to the request was not true, so the server did nothing. The client said "only do this if…" using `If-Match`, `If-Unmodified-Since` or `If-None-Match`, and the condition turned out false. It is the safety mechanism behind optimistic concurrency: you send the ETag of the version you edited, and if someone else has changed the resource in the meantime, the server refuses rather than overwriting their work.
- How do I fix a 412 error?
- Reload to fetch the latest version and reapply your change
- Is 412 a client error or a server error?
- 412 is in the 4xx range, which means client error. The request itself was the problem, so retrying it unchanged will usually return the same code.
Related pages
- 404 Not Found The server is reachable and working, but there is nothing at the address you ask
- 403 Forbidden The server understood the request and is refusing to allow it, and logging in wi
- 401 Unauthorized You need to authenticate, and either you did not or your credentials were reject
- 429 Too Many Requests You have sent more requests than the service allows in a given period.
- 400 Bad Request The server could not understand the request because something about it is malfor
- 413 Content Too Large The request body is bigger than the server is willing to accept.
- 422 Unprocessable Content The request is well-formed and understood, but the data in it fails the rules.
- 405 Method Not Allowed The URL exists, but it does not accept the HTTP method you used.
- 409 Conflict The request cannot be completed because it clashes with the current state of the
- 415 Unsupported Media Type The server will not accept the format of the body you sent.
- 408 Request Timeout The server gave up waiting for the client to finish sending its request.
- 410 Gone The resource was deliberately removed and is not coming back, and there is no fo