
As an example, the status code 416 can arise if the client asked for a part of the file that lies beyond the end of the file.
Note that status code 416 was previously called "Requested Range Not Satisfiable".
HTTP 416, "Range Not Satisfiable" (formerly "Requested Range Not Satisfiable"), means the client asked for a portion of a file that the server cannot supply. This typically happens because the requested byte range extends past the end of the actual file.
A server returns 416 when a client sends a Range header requesting a section of a resource that does not exist within the file. For example, requesting bytes 5000–6000 from a file that is only 4500 bytes long will trigger this response because that range lies beyond the file's endpoint.
First, send a HEAD request to the resource and read the Content-Length header to confirm the actual file size before constructing your Range header. Then adjust your byte range so both the start and end values fall within the valid range of the file. Keep in mind that byte positions are zero-indexed, so a 4500-byte file has valid positions 0 through 4499.
A 416 response should include a Content-Range header that signals the unsatisfied range, formatted as Content-Range: bytes */<total-length>, where the asterisk indicates the range could not be fulfilled and the total length reflects the current size of the resource. This gives the client the information it needs to correct the range and retry.
HTTP 400 (Bad Request) is a general error for malformed or invalid requests, while HTTP 416 is specific to byte-range requests where the syntax is correct but the requested range cannot be satisfied by the server. Both are 4xx client errors, but 416 signals a valid request that simply falls outside the available content boundaries.
Yes. Servers are not required to honor Range requests; many implementations will simply ignore the Range header and respond with 200 OK, returning the full resource instead. Clients should therefore not rely on receiving a 416 when a range is out of bounds, and should validate file size independently before making range requests.