HTTP 417 Expectation Failed vs 428 Precondition Required
Both HTTP 417 (Expectation Failed) and 428 (Precondition Required) belong to the 4xx Client Error category. 417 indicates that the server cannot meet the requirements of the Expect header. Meanwhile, 428 means that the server requires the request to be conditional (e.g., include If-Match header) to prevent lost updates.
Description
The server cannot meet the requirements of the Expect header.
When You See It
When the server doesn't support Expect: 100-continue.
How to Fix
Remove the Expect header from your request.
Description
The server requires the request to be conditional (e.g., include If-Match header) to prevent lost updates.
When You See It
When an API requires optimistic concurrency control via ETags.
How to Fix
Fetch the resource first to get its ETag, then include If-Match in your update request.
Key Differences
HTTP 417: The server cannot meet the requirements of the Expect header.
HTTP 428: The server requires the request to be conditional (e.g., include If-Match header) to prevent lost updates.
You encounter 417 when when the server doesn't support Expect: 100-continue.
You encounter 428 when when an API requires optimistic concurrency control via ETags.
When to Use Which
For 417 (Expectation Failed): Remove the Expect header from your request. For 428 (Precondition Required): Fetch the resource first to get its ETag, then include If-Match in your update request.