Error Codes Wiki

HTTP 412 Precondition Failed — Conditional Request Rejected

Warning4xx client error

About HTTP 412 Precondition Failed

HTTP 412 Precondition Failed means the server evaluated precondition headers (If-Match, If-Unmodified-Since) and the conditions were not met. This guide covers everything you need to know about this topic, including common causes, step-by-step solutions, and answers to frequently asked questions.

Here are the key things to understand: 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. Understanding these fundamentals will help you diagnose and resolve this issue more effectively.

The most common reasons this occurs include: 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. Identifying the root cause is the first step toward finding the right solution.

To resolve this, follow these recommended steps: Fetch the resource again to get the current ETag or Last-Modified value. Update your If-Match header with the fresh ETag before retrying. Clear browser cache if conditional requests are failing unexpectedly. Check CDN cache settings if 412 errors appear intermittently. Review your API client code to ensure ETags are refreshed after each modification. If these steps do not resolve the issue, consider consulting additional resources or a qualified professional.

This article is part of our HTTP Status Codes collection on Error Codes Wiki. We provide comprehensive, up-to-date information to help you find solutions quickly.

Quick Answer

What is the difference between 412 and 409?

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

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.