Skip to content
RU
← All Status Codes
412
Client Error

HTTP status code 412 Precondition Failed

412 Precondition Failed (RFC 9110, 15.5.13): an If-Match or If-Unmodified-Since condition was false, so nothing changed — usually a stale ETag.

Definition (RFC 9110)

HTTP status code 412 Precondition Failed is defined in RFC 9110 (HTTP Semantics), Section 15.5.13 — the current authoritative specification for HTTP semantics, published June 2022, which obsoletes the older RFC 7231 and RFC 2616.

Description

412 Precondition Failed occurs when conditional request headers (If-Match, If-None-Match, If-Modified-Since, If-Unmodified-Since) evaluate to false. This is used to prevent mid-air collisions: if a resource has been modified since you last read it, your update is rejected.

Essential for optimistic concurrency control in REST APIs.

Common Causes

  • Resource was modified by another client between read and write (lost update)
  • Stale ETag value in If-Match header
  • Conditional GET where the resource hasn't changed
  • Cache validation failure

How to Fix

  • Re-fetch the resource to get the latest ETag before updating
  • Implement merge strategies or conflict resolution UI
  • Use optimistic locking: include version number or ETag in update requests
  • Inform the user that the resource was updated by someone else

Check your website's HTTP status code

Check now →

Related Status Codes

Related guides

Longer-form reading on this topic from the knowledge base.

Automate this check

Set up continuous monitoring and get an alert when something breaks. No manual runs to remember.