4xx Client Errors

HTTP 417 Expectation Failed

The Expect header in the request cannot be met by the server.

When is 417 used?

  • 100-continue expectation cannot be met

How to handle a 417 response

Inspect the request — URL, method, headers, credentials, and body. Retrying the same request unchanged will usually fail again; 429 is the exception, where you should wait for the Retry-After period.

Check the status code a URL returns from the command line:

curl -s -o /dev/null -w "%{http_code}\n" https://example.com

How to return 417 from your server

Node.js (Express)

res.status(417).json({ message: 'Expectation Failed' });

Python (Flask)

return {"message": "Expectation Failed"}, 417

Go (net/http)

w.WriteHeader(417)

Frequently Asked Questions

What does HTTP 417 mean?

417 Expectation Failed: The Expect header in the request cannot be met by the server.

Is 417 an error?

Yes. 417 is in the 4xx Client Errors class. Client errors: the request is malformed, unauthorized, or targets something that does not exist.