Error Codes Wiki

HTTP 412 Precondition Failed — Conditional Request Rejected

Warning4xx client error

Overview

HTTP 412 Precondition Failed means the server evaluated precondition headers (If-Match, If-Unmodified-Since) and the conditions were not met.

Key Details

  • Occurs when conditional headers like If-Match or If-Unmodified-Since fail
  • The server tested the precondition before executing the request and it was false
  • Commonly used in optimistic concurrency control with ETags
  • Prevents overwriting changes made by another client since your last read
  • Different from 409 Conflict — 412 is specifically about conditional header evaluation

Common Causes

  • If-Match header ETag does not match the current resource ETag
  • If-Unmodified-Since date is older than the resource last-modified date
  • Stale cache sending outdated conditional headers
  • CDN or proxy adding conditional headers that conflict with server state

Steps

  1. 1Fetch the resource again to get the current ETag or Last-Modified value
  2. 2Update your If-Match header with the fresh ETag before retrying
  3. 3Clear browser cache if conditional requests are failing unexpectedly
  4. 4Check CDN cache settings if 412 errors appear intermittently
  5. 5Review your API client code to ensure ETags are refreshed after each modification

Tags

http412precondition-failedetagconditional-request

More in 4xx Client Error

Frequently Asked Questions

412 means a precondition header check failed. 409 means the request conflicts with server state regardless of conditional headers.