Skip to content

416 Range Not Satisfiable — Meaning, Common Causes & How to Fix

416 4xx Client Error RFC 9110 §15.5.17

416 Range Not Satisfiable means: The Range header asked for bytes that do not exist in the resource — beyond its size or otherwise unsatisfiable. The response should include Content-Range: bytes */<size> so the client learns the actual extent. Client-error 4xx codes mean the request itself is the problem: malformed syntax, missing credentials, forbidden access, a nonexistent resource or a violated precondition. The server is telling the client what to change; retrying the identical request without a fix will reproduce the same error. In practice you will meet 416 when resuming a download with an offset past the end of a changed/smaller file; a video player seeking beyond the media duration after a re-encode; a buggy chunked downloader computing wrong byte offsets. On the client side, read Content-Range */size, clamp ranges to the real size, and restart the download if the resource changed underneath you. On the server side, always send Content-Range with the true size on 416; validate Range syntax and ignore malformed ranges per RFC rules.

Advertisement
Ad slot · ref-top

When 416 happens

  • Resuming a download with an offset past the end of a changed/smaller file
  • A video player seeking beyond the media duration after a re-encode
  • A buggy chunked downloader computing wrong byte offsets

How to fix it

On the client

Read Content-Range */size, clamp ranges to the real size, and restart the download if the resource changed underneath you.

On the server

Always send Content-Range with the true size on 416; validate Range syntax and ignore malformed ranges per RFC rules.

Should you retry?

Not retryable as-is: change the request (credentials, payload, URL) first.

Debugging steps

When 416 appears unexpectedly, start by capturing the full exchange: 'curl -i' or the browser DevTools Network tab shows the exact status line and response headers, which often carry the real explanation. Read the error body first — well-designed APIs name the offending field or missing credential. Then diff your actual request, headers included, against the documented contract. For this code specifically, check whether the most common trigger applies to your situation: resuming a download with an offset past the end of a changed/smaller file. Compare your exchange against the raw HTTP example above. If you operate the server, correlate the timestamp with application and proxy logs using the request id; if you are the client, verify the request shape against the API documentation before changing anything or retrying.

Notes & gotchas

The Content-Range: bytes */size header on a 416 tells the client the resource's true extent, which is exactly what a resuming downloader needs to clamp its offsets or restart.

Examples

Raw HTTP
HTTP/1.1 416 Range Not Satisfiable
Content-Range: bytes */2048
Content-Type: application/json
Content-Length: 128

{
  "error": "range_not_satisfiable",
  "message": "Resuming a download with an offset past the end of a changed/smaller file"
}
curl
curl -i -H "Range: bytes=999999-" https://cdn.example.com/media/file.mp4   # inspect Content-Range: bytes */size
JavaScript (fetch)
const res = await fetch("https://api.example.com/v1/resource");
if (res.status === 416) {
  const problem = await res.json(); // read field-level details
  // fix the request (credentials, payload, URL) — identical retries keep failing
  throw new RequestError(problem);
}
Python (requests)
import requests

res = requests.get("https://api.example.com/v1/resource", timeout=10)
if res.status_code == 416:
    problem = res.json()  # field-level error details
    # correct the request before retrying — identical retries keep failing
    raise RequestProblem(problem)

Frequently asked questions

What does 'Content-Range: bytes */2048' mean?

The range was unsatisfiable and the resource is 2048 bytes total; the asterisk replaces the requested span because none of it could be served.

Why did my resumed download fail with 416?

The file changed (or shrank) since the partial download, so your saved offset is now past the end. Verify ETag/size before resuming, or restart.

Are 4xx errors always the client's fault?

By contract yes — the server asserts the request must change. In practice servers sometimes misuse 4xx for their own problems (e.g. 400 for internal validation bugs), so read the error body before blaming your client code.

Should I retry 4xx responses automatically?

Generally no: the server says the request must change. Exceptions are 408 (fresh connection), 425 (after handshake) and 429 (after Retry-After). Blind retries of 400/401/403/404 just burn quota.

Advertisement
Ad slot · ref-in-article

Try the JSON Validator

Check JSON syntax and locate errors by line and column.

Open tool →