Skip to content
Skip to content
← All Status Codes
412
Client Error

412 Precondition Failed

One or more conditions given in the request headers evaluated to false on the server.

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