4xx Client Error

HTTP 412 Precondition Failed

One or more conditions given in the request headers (like If-Match or If-Unmodified-Since) evaluated to false on the server. The conditional request cannot be fulfilled.

Common Causes

  • If-Match ETag doesn't match current resource version
  • If-Unmodified-Since date is older than last modification
  • Optimistic concurrency check failed
  • Conditional PUT/PATCH with stale data

How to Fix

  1. 1Fetch the latest resource version and update your ETag/date
  2. 2Re-read the resource before attempting the conditional update
  3. 3Remove precondition headers if strict versioning isn't needed

Example

HTTP 412 Precondition Failed
PUT /api/doc/1 HTTP/1.1
If-Match: "old-etag"

→ 412 Precondition Failed
→ Resource was modified by another client

Related Client Error Codes