416 Range Not Satisfiable: why downloads and video seeks fail

A 416 means the byte range a client asked for doesn't fit the file. Learn how Range requests work, why resumed downloads and video seeks break, and how to fix it.

· 6 min read · By the Spot Downtime team

A 416 Range Not Satisfiable response means the client asked for a part of a file, and the part it asked for doesn't exist. The usual scene: a download resumes after an interruption, or a video player seeks forward, and the server answers 416 instead of the bytes. The file may have changed, a cache may be confused, or a proxy may be mangling the header.

How range requests work

HTTP lets a client request only some bytes of a resource. Download managers use it to resume, browsers use it to seek in video and audio, and PDF viewers use it to load later pages first. The client sends a Range header:

bash
# First 1000 bytes
curl -i -H "Range: bytes=0-999" https://example.com/video.mp4

# Everything from byte 5000000 to the end
curl -i -H "Range: bytes=5000000-" https://example.com/video.mp4

# The last 500 bytes
curl -i -H "Range: bytes=-500" https://example.com/video.mp4

A server that supports ranges replies 206 Partial Content with a Content-Range header such as bytes 0-999/48213376. It advertises support with Accept-Ranges: bytes on normal responses. A server that doesn't support ranges simply ignores the header and sends 200 with the whole file.

What 416 means exactly

The server returns 416 when it understood the Range header but none of the requested ranges overlap the current size of the resource. A start position past the end of the file is the classic case: the file is 1,000,000 bytes and the client asks for bytes=2000000-.

The response should include Content-Range: bytes */1000000, which tells the client the real length. A well-written client reads that, discards its stale offset and starts over.

bash
curl -i -H "Range: bytes=2000000-" https://example.com/report.pdf

HTTP/1.1 416 Range Not Satisfiable
Content-Range: bytes */1000000

Cause 1: the file changed under a resumed download

A download got to 400 MB, the connection dropped, and the client retried with Range: bytes=400000000-. In between, you published a new, smaller build at the same URL. Now the offset is past the end, and the server answers 416.

Good clients protect against this with If-Range, which sends the old ETag or Last-Modified value along with the range. If the file changed, the server ignores the range and returns the full new file with 200. Check that your server sends a stable ETag or Last-Modified so that this works.

  • Version your artifacts: app-1.4.2.zip instead of overwriting app-latest.zip in place.
  • If you must overwrite, upload the new file under a temporary name and rename it, so a half-written file is never served.
  • On the client side, on 416 delete the partial file and restart from byte 0.

Cause 2: a CDN or cache holds the wrong length

If a CDN cached the object with one size and the origin now has another, ranges computed against one fail against the other. Purge the URL and retest. Also check for a mismatch between Content-Length and the real body size, which some proxies produce when they compress on the fly. Ranges are byte offsets into the encoded body, so compression in the middle of the chain breaks them.

Cause 3: empty or zero-byte files

Any range request against a zero-byte file is unsatisfiable, because there is no byte 0. A player that always sends Range: bytes=0- gets 416 from a strict server when an upload failed and left an empty file. If media plays for some files but not others, compare their sizes first.

Cause 4: a malformed or oversized Range header

Servers reject ranges they can't parse or that make no sense, such as bytes=500-100 (end before start). Some answer 400, others 416. Nginx and Apache also limit how many ranges one request can carry, as a defence against requests that ask for thousands of overlapping pieces. If you have a custom client, log the exact Range header it sends.

Cause 5: a proxy or app that mishandles ranges

If an application streams files itself, it has to handle ranges. Frameworks mostly do for static files, but code that reads a file into memory and sets headers by hand often computes Content-Range wrongly. Off-by-one errors are common because the end of a range is inclusive: a file of N bytes ends at byte N-1.

js
// Express: res.sendFile and express.static handle Range for you.
res.sendFile("/srv/files/video.mp4");

// Hand-rolled responses: the range end is inclusive.
const size = stat.size;
const [startStr, endStr] = range.replace("bytes=", "").split("-");
const start = parseInt(startStr, 10);
const end = endStr ? parseInt(endStr, 10) : size - 1;
if (Number.isNaN(start) || start >= size || end < start) {
  res.status(416).set("Content-Range", `bytes */${size}`).end();
  return;
}
res.status(206).set({
  "Content-Range": `bytes ${start}-${Math.min(end, size - 1)}/${size}`,
  "Accept-Ranges": "bytes",
  "Content-Length": Math.min(end, size - 1) - start + 1,
});

Debugging checklist

  • Request the file with curl -I and note Content-Length, Accept-Ranges and ETag.
  • Repeat a range request with a start inside the file. If that works and the client's offset fails, the offset is stale.
  • Compare responses from the origin and through the CDN. Different sizes point to a stale cache.
  • Try a fresh download without a partial file. If it works, the file was replaced during the earlier download.
  • Check the server log for the exact Range header the failing client sent.
HTTP headers checkerSee the status, Accept-Ranges, Content-Length and ETag a URL returns.

416 is not an outage, but it can hide one

Visitors rarely report it

A broken range response doesn't take the page down. It makes video not seek, downloads stall at 99% and installers fail halfway, and those complaints trickle in slowly.

If files are part of your product, add a check on the download URL. A website monitor can request the URL and alert on any unexpected status. Combine it with an API monitor that sends a Range header and expects 206, so a CDN or proxy change that breaks partial content is caught before users hit it. For the neighbouring client errors, see 413 Request Entity Too Large and 400 Bad Request. Remember: 416 says the range is wrong, not that the file is gone, so the fix is almost always to restart the request without a range.

Get new guides by email

Practical posts on monitoring, outages, error fixes and on-call, when they're published. No spam.

Unsubscribe from any email with one click. See our privacy policy.

Keep reading