At One Place

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

  1. Reload to fetch the latest version and reapply your change
  2. If a sync client keeps failing this way, force a full refresh of its local copy

If it's your site

  1. 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
  2. Make sure ETags are stable across your server fleet; inconsistent ETags cause spurious 412s behind load balancers
  3. 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

Sources

  1. Hypertext Transfer Protocol (HTTP) Status Code Registry — IANA
  2. RFC 9110: HTTP Semantics — IETF

How these figures are compiled and checked