What does HTTP 412 mean?
A condition in the request headers (If-Match, If-Unmodified-Since) was not met. Used for safe concurrent updates: the client sends the ETag it last saw, and the server rejects the update with 412 if the resource changed since then.
4xx Client error: The request has a problem the client can fix: wrong URL, missing credentials, bad data or too many requests.
How to fix 412 Precondition Failed
- Re-fetch the resource and its current ETag, then retry.
412 and SEO
Not relevant for web pages.
Example response
HTTP/1.1 412 Precondition Failed
How to return a 412 response
Node.js (Express)
res.status(412).json({ error: 'Precondition Failed' });PHP
http_response_code(412);Python (Flask)
return {'error': 'Precondition Failed'}, 412Go (net/http)
w.WriteHeader(412)nginx
return 412;
Related status codes
- 409 Conflict — The request conflicts with the current state of the resource.
- 304 Not Modified — The cached copy is still valid, so the server sends no body.
- 428 Precondition Required — The server requires the request to be conditional.
Check which status code a URL returns with the HTTP header checker.
Perguntas frequentes
What does status code 412 mean?
If-Match, If-Unmodified-Since) was not met.