412 Precondition Failed

A request precondition was not satisfied, so the server refused to apply the requested operation.

All HTTP status codes

What does HTTP 412 mean?

Conditional requests protect assumptions about resource state. If-Match can prevent an update based on an outdated version, while other conditions serve different purposes. A 412 means the supplied condition failed; removing the condition may defeat the intended protection. Determine which header failed and why, then present the current state so a person or client can resolve it safely.

An investigation example

Illustrative concurrent-edit investigation
PUT response: 412 Precondition Failed
Submitted If-Match identifies revision 18.
Current resource is revision 19.
Action: compare changes and submit a deliberate reconciliation.
Verify: the accepted update preserves the intended edits from both versions.

Common causes

  • An update uses an old ETag after another user saves a newer version.
  • A conditional request specifies a modification date or existence condition that no longer matches.

Diagnose the response

Compare the submitted validator with the latest representation and reconcile the change before attempting another write.

  • Inspect conditional headers such as If-Match and If-Unmodified-Since. Compare their values with the current representation rather than retrying with the same stale condition.
  • Fetch the latest resource and reconcile the intended update. Keep the user's proposed changes available while resolving differences.
  • Resubmit with the new validator only after reviewing the current state. Removing the precondition just to force the write can overwrite another user's work.

What it means for website monitoring

Treat failed preconditions as state-protection evidence. If they appear unexpectedly, inspect validator and cache behaviour before weakening the concurrency controls.

Reference