HTTP Status Codes

HTTP 412 Precondition Failed

412
MediumWeb ServerReference page

Precondition Failed — a conditional header did not match current resource state

A 412 Precondition Failed response appears when the request includes one or more conditional headers and the server evaluates at least one of them as false. It is commonly used to protect shared resources from stale writes, lost updates, or actions that depend on an older resource version.

Visual summary

A quick reference view of how HTTP 412 rejects a request when the supplied condition evaluates false against the resource's current state.

HTTP 412 visual summary showing a conditional write request stopped because its validator no longer matches current resource state
Visual summary: 412 means the client sent a condition, but the current resource state did not satisfy it.

What 412 Means

The shortest useful reading of this status code.

Precondition Failed means a conditional header did not match current resource state.

For conditional requests, the key distinction is that 412 means a condition was present but evaluated false against the current resource state.

Quick read

Conditional check failed

A 412 means the request included a condition, but the current resource state did not satisfy it.

Technical Context

How this status behaves without turning the page into a repair guide.

Condition evaluated false

A 412 means the client did send a condition, but the condition did not pass. The request can be structurally correct and the resource can exist, yet the server still blocks the action because the current state no longer satisfies the validator or timestamp guard attached to the request.

Concurrency boundary

That makes 412 distinct from both 428 and 409. A 428 says the required condition was missing in the first place, while a 409 is a broader conflict signal. A 412 is narrower: the condition was present, the server checked it, and the result was false.

Related HTTP Codes

Nearby HTTP status codes help clarify how 412 differs inside the same response family.

Common Causes

If-Match or If-Unmodified-Since header value does not match the current resource state

The request carried a condition, but the server checked the resource and found the condition was false.

Optimistic concurrency control preventing an overwrite of a concurrently modified resource

The server blocks an update because another change already moved the resource to a newer state.

Conditional PUT request targeting a resource version that has since changed

The client is writing against stale assumptions about which version is current.

Typical Scenarios

01

An API tries to update a record with an If-Match value that no longer matches the current version

02

A client sends If-Unmodified-Since after another edit already changed the resource

03

A document workflow rejects a write because the request is based on a stale copy

What To Know

A 412 usually points to state drift between when the client last observed the resource and when it attempted the next action. The visible pattern fits concurrency protection or stale validators rather than malformed syntax or broad server failure.

Frequently Asked Questions

Common interpretation questions about HTTP 412.

It is usually triggered by conditional headers such as If-Match or If-Unmodified-Since when the current resource state no longer satisfies the condition sent by the client.

A 412 means a condition was provided but failed. A 428 means the server required a condition and did not receive an acceptable one at all.