412 Error

A 412 Precondition Failed error is a webserver’s code for:

“One of the preconditions you set in your request didn't match reality on the server.”

A 412 Precondition Failed error indicates that one or more conditions specified in the request header fields evaluated to false when tested on the server.

Clients use conditional headers (such as If-Match, If-None-Match, If-Modified-Since, or If-Unmodified-Since) to ensure they only read or modify data if certain prerequisites are met—like preventing two users from accidentally overwriting each other’s edits.

Determining why

The client said: “Only update this resource if its version matches ETag X”. Meanwhile, another process or user updated the resource, changing the ETag. The server tested the condition, noticed it evaluated to false, and rejected the request to safeguard data integrity.

Steps you could possibly take:

  • Reload the application - Fetch the latest version of the resource so your client holds the current ETag or timestamp.
  • Clear browser cache - Outdated cached conditional headers can occasionally cause validation mismatches.
  • If you are a developer:
    • Implement optimistic concurrency controls properly: fetch the updated resource, re-apply user changes, and resubmit with the new ETag.
    • Inspect the If-Match or If-Unmodified-Since headers being sent by your client code.

Source: RFC 9110 Section 15.5.13 (HTTP Semantics)