HTTP Status Codes

412 Precondition Failed

A conditional request failed its precondition — for example If-Match did not match the current ETag — preventing a lost-update overwrite.

What it means

412 Precondition Failed occurs when a conditional header such as If-Match, If-Unmodified-Since or If-None-Match evaluates false. It is the backbone of optimistic concurrency: a client sends the ETag it edited against, and the server rejects the write if the resource changed meanwhile.

HTTP EXCHANGE
> PUT /doc/12 HTTP/1.1
> If-Match: "v7"

< HTTP/1.1 412 Precondition Failed

Why it matters

  • It prevents lost updates by rejecting writes based on stale versions.
  • It complements 409 for robust concurrency control.

Common mistakes

  • Not sending If-Match on updates, allowing silent overwrites of concurrent edits.
  • Confusing 412 (precondition on a write) with 304 (precondition satisfied on a read).

How WebInspect checks this

  • WebInspect reports ETag and conditional-header support relevant to safe concurrent updates.