416

Range Not Satisfiable

4xx Client Error

ELI5

You asked for a specific part of a file (like pages 50-60), but the file only has 10 pages. I can't give you what doesn't exist.

Server perspective

Use 416 when a supported Range request is syntactically valid but unsatisfiable for the selected representation.

When to use

  • Return 416 when the requested byte range falls outside the current representation length
  • Use it only when range handling is relevant for the target resource
  • Range request beyond file size
  • Invalid byte range specifications
  • Start position greater than file length
  • Malformed Range headers

How to respond

  • Include Content-Range in the form bytes */<complete-length>
  • Expose Accept-Ranges when you want clients to know range requests are supported

Headers to consider

  • Content-Range
  • Accept-Ranges

Response body

  • Include Content-Range with the current representation length when possible so the client can correct its range.

Server-side pitfalls

  • Do not use 416 when there was no meaningful Range request to evaluate
  • Do not omit the complete length when it is available
  • Valid range requests (use 206 Partial Content)
  • No Range header provided (use 200 OK)
  • Server doesn't support ranges (use 200 OK)

Examples

Range beyond file size

Request:GET https://api.example.test/video.mp4 # Headers Range: bytes=100000000-200000000
Response:416 Range Not Satisfiable # Headers Content-Range: bytes */50000000 Content-Type: application/json # Body { "error": "range_not_satisfiable" }

Requested range starts beyond the 50MB file size

References

Related Status Codes