417 Expectation Failed
The server cannot meet the requirement in the request's Expect header, which is almost always Expect: 100-continue.
What 417 Expectation Failed means
The only expectation defined in HTTP is 100-continue. A server or proxy that does not support it can reply 417.
A client that gets 417 can retry the same request without the Expect header.
Common causes
- A server or proxy that does not handle Expect: 100-continue.
- A client library adding Expect: 100-continue to large POST requests by default.
How to fix 417 Expectation Failed
- Remove the Expect header and resend. In curl, pass -H "Expect:" to stop it being sent.
- On the server, enable 100-continue support or ignore the header.
Headers that go with it
Expect
Example response
HTTP/1.1 417 Expectation Failed
Content-Type: text/plain; charset=utf-8
417 Expectation FailedHow to check for a 417 response
cURL
# Print only the status code
curl -s -o /dev/null -w "%{http_code}\n" https://example.com/JavaScript (Node.js)
const res = await fetch("https://example.com/");
if (res.status === 417) {
console.log(res.status, res.statusText);
}Python
import requests
res = requests.get("https://example.com/")
if res.status_code == 417:
print(res.status_code, res.reason)Go
res, err := http.Get("https://example.com/")
if err != nil {
log.Fatal(err)
}
defer res.Body.Close()
if res.StatusCode == 417 {
fmt.Println(res.Status)
}Specification
417 Expectation Failed is defined in RFC 9110, section 15.5.18.
Related status codes
- 100
The server got the request headers and has not rejected them, so the client should go ahead and send the request body.
- 400
The server could not understand the request because something in it is malformed, like broken JSON, bad syntax or invalid headers.