You run wget -c on a large ISO, expect it to pick up where the last attempt stopped, and instead get:
HTTP request sent, awaiting response... 416 Requested Range Not Satisfiable The file is already fully retrieved; nothing to do. Sometimes the command exits immediately with status 0. Sometimes it sits idle for a minute or more first. In both cases the message is misleading: wget is inferring that your local file is complete, not proving it.
This tutorial reproduces the response against a local server you control, explains what the headers actually say, separates the four common causes, and shows how to recover without appending new bytes to an old partial file. It finishes with a preflight and postflight wrapper that checks range support, Content-Range, final size and checksum before you trust a resumed download.
Table of Contents
- How wget Resume Normally Works
- Build a Range-Capable Test Server
- Reproduce a 416 Response Step by Step
- What wget Resume 416 Really Means
- The Four Causes of a Failed Resume
- Cause 1: The Local File Is Already Complete
- Cause 2: The Remote File Changed
- Cause 3: The Server Ignores or Rejects Range
- Cause 4: Keep-Alive Stalls After 416
- Recover Without Corrupting the Download
- Preflight and Postflight Checks
- A Safe Resume Script
- Conclusion
How wget Resume Normally Works
wget -c (or --continue) looks at the size of the local file and asks the server to send the rest. On an HTTP server that supports byte ranges, the request looks like this:
GET /payload.bin HTTP/1.1 Host: example.com Range: bytes=400000- A server that supports ranges answers 206 Partial Content with a Content-Range header naming the byte interval and the complete resource length:
HTTP/1.1 206 Partial Content Accept-Ranges: bytes Content-Range: bytes 400000-1048575/1048576 Content-Length: 648576 For the command-level baseline — saving files, inspecting headers, and using -c in scripts — this guide to resuming interrupted downloads with wget -c walks through the normal flow. The key point here is that a resume depends on three separate promises: the server advertises range support, it honors the requested start offset, and the bytes it sends belong to the same version of the file you already have. wget depends on the first two and cannot verify the third at all. MDN's HTTP range requests guide explains the 206/Content-Range contract and how to probe a server.
When one of those promises breaks, the result is not always a clean error. It can be a 416, a full 200 response that restarts the download, or a 206 that appends mismatched bytes.
Build a Range-Capable Test Server
To see the failure modes without risking a real download, use a small Python server that implements byte ranges and returns a proper 416. Save this as range_server.py:
#!/usr/bin/env python3 """range_server.py — a deliberately small Range-capable file server. Usage: python3 range_server.py ROOT [PORT] """ import os import re import sys from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer from urllib.parse import unquote, urlsplit ROOT = os.path.abspath(sys.argv[1] if len(sys.argv) > 1 else ".") PORT = int(sys.argv[2]) if len(sys.argv) > 2 else 8000 RANGE_RE = re.compile(r"^bytes=(\d*)-(\d*)$") class RangeHandler(BaseHTTPRequestHandler): protocol_version = "HTTP/1.1" def do_HEAD(self): self.serve(head_only=True) def do_GET(self): self.serve(head_only=False) def serve(self, head_only): rel = unquote(urlsplit(self.path).path).lstrip("/") path = os.path.abspath(os.path.join(ROOT, rel)) if not path.startswith(ROOT + os.sep) or not os.path.isfile(path): self.send_error(404) return size = os.path.getsize(path) start, end, status = 0, size - 1, 200 header = self.headers.get("Range") if header: match = RANGE_RE.match(header.strip()) if not match: self.send_error(400, "Unsupported Range header") return first, last = match.groups() if first == "" and last == "": self.send_error(400, "Empty Range header") return if first == "": start = max(size - int(last), 0) else: start = int(first) if last: end = min(int(last), size - 1) if start >= size or start > end: self.send_response(416) self.send_header("Content-Range", f"bytes */{size}") self.send_header("Content-Length", "0") self.end_headers() return status = 206 length = end - start + 1 self.send_response(status) self.send_header("Accept-Ranges", "bytes") self.send_header("Content-Type", "application/octet-stream") self.send_header("Content-Length", str(length)) if status == 206: self.send_header("Content-Range", f"bytes {start}-{end}/{size}") self.end_headers() if head_only: return with open(path, "rb") as source: source.seek(start) remaining = length while remaining > 0: chunk = source.read(min(65536, remaining)) if not chunk: break self.wfile.write(chunk) remaining -= len(chunk) if __name__ == "__main__": ThreadingHTTPServer(("127.0.0.1", PORT), RangeHandler).serve_forever() It answers a satisfiable range with 206 plus Content-Range, an unsatisfiable one with 416 plus Content-Range: bytes */SIZE, and includes Accept-Ranges: bytes on successful file responses. Because it sends Content-Length: 0 with the 416, it will not reproduce the keep-alive stall described later; that requires a server that leaves the response body undelimited and holds the connection open.
Reproduce a 416 Response Step by Step
Set up a served directory and a separate download directory. Keeping them apart matters: if you serve and download into the same directory, wget will overwrite the source file you are trying to serve.
mkdir -p /tmp/wget416/srv /tmp/wget416/dl head -c 1048576 /dev/urandom > /tmp/wget416/srv/payload.bin python3 /path/to/range_server.py /tmp/wget416/srv 8000 & cd /tmp/wget416/dl First, download the file normally:
wget -c http://127.0.0.1:8000/payload.bin Now truncate the local copy and resume it. This is the healthy path:
truncate -s 400000 payload.bin wget -c http://127.0.0.1:8000/payload.bin wget sends Range: bytes=400000-, the server answers 206 Partial Content, and the file grows back to 1,048,576 bytes. You can inspect the same response without downloading the body by asking for that range with curl:
curl -s -D - -o /dev/null \ -H 'Range: bytes=400000-' \ http://127.0.0.1:8000/payload.bin | head -n 8 HTTP/1.1 206 Partial Content Server: BaseHTTP/... Date: ... Accept-Ranges: bytes Content-Type: application/octet-stream Content-Length: 648576 Content-Range: bytes 400000-1048575/1048576 Now resume a file that is already complete:
wget -c http://127.0.0.1:8000/payload.bin HTTP request sent, awaiting response... 416 Requested Range Not Satisfiable The file is already fully retrieved; nothing to do. Check the exit status:
echo $? On affected wget versions this prints 0. That is the first trap: a script that only checks $? will treat the 416 as a successful download, even though wget never compared the file's contents with the server's.
To make the server state unambiguous, ask for a range that is deliberately past the end:
curl -s -D - -o /dev/null \ -H 'Range: bytes=9999999-' \ http://127.0.0.1:8000/payload.bin | head -n 8 HTTP/1.1 416 Requested Range Not Satisfiable ... Content-Range: bytes */1048576 Content-Length: 0 That Content-Range: bytes */1048576 is the most useful line in the exchange. It says: none of your requested ranges overlap, and the resource is currently 1,048,576 bytes long.
What wget Resume 416 Really Means
RFC 9110 defines 416 Range Not Satisfiable as the response when none of the ranges in the request overlap the current extent of the resource, or when the server rejects the range set. For a byte-range request, the server should include a Content-Range field with an unsatisfied-range value: bytes */<current-length>.
That gives you a three-way test:
| What you see | What it means | What to do |
|---|---|---|
416 + Content-Range: bytes */N, local size = N | The request started at or beyond the end of the resource. The local file is probably complete. | Verify with a checksum before trusting it. |
416 + Content-Range: bytes */N, local size ≠ N | The local file is larger than the remote file, or the remote file shrank. | Quarantine the local file and download fresh. |
416 without Content-Range | The server rejected the range but did not reveal the current length. | Probe separately; do not assume the file is complete. |
The exit status is not a reliable substitute for this analysis. A 2026 wget bug report documents a retry that ended in a 416 yet was reported to the caller as a successful fetch. Treat $? as one signal, not the verdict.
Also check whether the 416 came from the origin or from something in between. A proxy or CDN that mishandles Range can return a 416 even when the origin would have served a valid 206. Running the same probe directly against the origin, or reading the Server and Via headers, separates the two.
The Four Causes of a Failed Resume
Cause 1: The Local File Is Already Complete
This is the ordinary case. Your local file is 1,048,576 bytes, the remote file is 1,048,576 bytes, and wget asks for bytes=1048576-. The first byte position equals the resource length, so the range cannot overlap anything. The server returns 416, and wget prints its "already fully retrieved" message.
The right response is not to delete the file automatically. Compare the local size with the Content-Range total, then verify a published checksum:
stat -c '%s' payload.bin curl -fsSL http://127.0.0.1:8000/payload.bin.sha256 sha256sum payload.bin If the checksums match, you are done; the 416 was accurate. If there is no published checksum, size agreement is evidence but not proof. A file can be the right length and still be corrupt — for example, if a previous resume appended bytes from a different version of the file.
Cause 2: The Remote File Changed
This is the dangerous case. The remote file may have been rebuilt, replaced by a new release, or truncated. Two sub-cases matter.
The remote file shrank. Your local file is larger than the remote one, so the resume offset is beyond the end of the resource. The server returns 416 with a smaller total in Content-Range. An older Launchpad report shows exactly this: the local file was larger than the server's copy, wget printed "already fully retrieved," and it exited with status 0. Recovery is to move the local file aside and download fresh. Do not simply truncate the local file to the new length, because the first N bytes may also have changed.
The remote file changed but stayed the same size. This is worse, because the server can return a perfectly valid-looking 206 for your offset. wget appends the new file's tail to the old file's head, and the final size can look correct. The content is a chimera. The wget manual is explicit about this limitation: it has no way of verifying that the local file is really a valid prefix of the remote file, and using -c against a file that changed rather than grew produces a garbled file.
This is why checksum verification matters for resumable downloads of release artifacts, ISOs, and datasets. If the publisher provides a SHA-256 sidecar, compare it after every resume. If not, compare a strong ETag captured before and after the download, or fall back to a fresh download when you cannot establish identity.
Cause 3: The Server Ignores or Rejects Range
Not every server that accepts a Range header honors it. Some configurations disable byte ranges, some proxies strip the header, and some dynamic endpoints cannot seek. The result is usually a 200 OK with the entire file, not a 416. The same wget manual notes that when a server does not support continued downloading, wget restarts the download from scratch and overwrites the existing file. That is safe for the file but wastes the partial download and can surprise a script that expected a resume.
A 416 can also come from a server that treats the range as invalid for reasons unrelated to your local file — for example, a range request on a zero-length resource, a malformed or multi-range request, or a server-side cap on the number of ranges. The diagnostic is the same: read Content-Range, and probe with a simple one-byte range.
curl -s -D - -o /dev/null -H 'Range: bytes=0-0' \ http://127.0.0.1:8000/payload.bin | head -n 8 A 206 with Content-Range: bytes 0-0/1048576 proves the server honors a basic range. A 200 proves it ignored the header. A 416 on bytes=0-0 means the resource is empty or the server is rejecting ranges outright.
There is also a wget-specific wrinkle: some options cause wget to send a preliminary HEAD request, and older reports show -c adding a Range header to that HEAD request as well. A server can answer that HEAD with 416 even though the subsequent GET would have worked. This was reported as wget bug #60289 and closed as not reproducible on wget 1.21.2, so treat it as a historical explanation for odd logs rather than a current default. If you see a HEAD line in wget -d output carrying Range, check the version and the option combination before blaming the file.
Cause 4: Keep-Alive Stalls After 416
A 416 response can leave wget waiting instead of exiting. A bug-wget report from May 2023 describes exactly this with wget 1.21.3: the server sends 416, wget acknowledges it, both sides go silent for about 65 seconds, and then the server closes the connection. The reporter traced the wait to wget's attempt to skip a short response body that never arrived, and found that adding --no-http-keep-alive made the command finish immediately.
The mechanism is a mismatch in connection handling. With keep-alive, wget tries to read and discard any response body before reusing the socket. If a 416 arrives without a body that wget can delimit — no Content-Length, or chunked framing that never terminates — wget can wait for bytes that never come. Eventually a timeout or the server's FIN releases it.
Practical workarounds:
wget -c --no-http-keep-alive URL or bound the wait:
wget -c --read-timeout=20 --timeout=30 URL These options make the failure faster, not more correct. A stall that hides a stale partial is still a stale partial. Use --no-http-keep-alive when scripting a one-shot resume, and keep a timeout so a misbehaving server cannot block a job indefinitely. The combination in the original report was -N --no-if-modified-since --continue; if you do not need timestamping, drop -N, and if you do need it, add the keep-alive workaround and verify the result.
Recover Without Corrupting the Download
Use a decision tree rather than a single command. The goal is to preserve evidence, establish the remote identity, and only then decide whether the local bytes are worth keeping.
- Stop writing to the suspect file. Capture the wget output with headers and record the local size:
wget -S -c URL 2>&1 | tee wget.log stat -c '%n %s bytes' payload.bin - Get the remote length from the 416 itself. Look for
Content-Range: bytes */Nin the log or in acurlprobe. If it is missing, ask for a one-byte range or aHEAD. - Compare lengths. If local size equals the remote total, go to step 4. If local size is larger, the remote shrank or changed: quarantine the file. If local size is smaller but the remote identity changed, also quarantine.
- Verify content. Compare a published SHA-256, a strong ETag, or a known-good copy. If you cannot verify, do not promote the file to a trusted name.
- Quarantine, don't delete. Rename the suspect file with a timestamp so you can inspect or resume it later:
mv payload.bin payload.bin.stale.$(date +%s) - Download under a fresh name. Use a temporary name, verify, then rename atomically:
wget --no-http-keep-alive -O payload.bin.new URL sha256sum payload.bin.new mv payload.bin.new payload.bin The mv is atomic on the same filesystem, so readers never see a half-verified file at the final path.
- If you must resume, resume into a copy, not the original. Keep the original partial as the fallback until the new copy passes verification.
A simple guard against the "already complete" false positive is to make the wrapper treat a 416 as a failure unless the local size matches the remote total and the checksum matches. That turns wget's optimistic message into an explicit decision.
Preflight and Postflight Checks
Before a resume, check four things:
| Check | Command | Pass condition |
|---|---|---|
| Range support advertised | curl -fsSI URL | Accept-Ranges: bytes |
| Range actually honored | curl -s -D - -o /dev/null -H 'Range: bytes=0-0' URL | 206 + Content-Range: bytes 0-0/N |
| Remote length | curl -fsSI URL | a numeric Content-Length |
| Local length | stat -c %s FILE | known and comparable |
After the resume, check three more:
| Check | Command | Pass condition |
|---|---|---|
| Final size | stat -c %s FILE | equals remote length |
| Checksum | sha256sum FILE | equals the published digest |
| Exit status | echo $? | 0, but never the only check |
Accept-Ranges is an advertisement, not a guarantee. MDN's Accept-Ranges reference notes that a value of bytes indicates support, while none indicates the server does not support ranges; a missing header is inconclusive. That is why the one-byte range probe matters: it tests behavior rather than intent.
A Safe Resume Script
The following wrapper refuses to resume unless the server advertises and honors ranges, keeps the partial download in a side directory, checks the final size, and verifies a .sha256 sidecar when one exists. Save it as safe-resume.sh and make it executable.
#!/usr/bin/env bash # safe-resume.sh — resume a download only after range and size checks. set -euo pipefail url=${1:?usage: safe-resume.sh URL [DEST]} dest=${2:-$(basename "${url%%\?*}")} name=$(basename "${url%%\?*}") base=${url%%\?*} work="${dest}.resume.$$" mkdir -p "$work" success=0 cleanup() { if (( success )); then rm -rf "$work" else echo "Working files kept in $work" >&2 fi } trap cleanup EXIT # Preflight: range support and remote length. curl -fsSI --max-time 30 "$url" -o "$work/head" grep -qi '^accept-ranges:[[:space:]]*bytes' "$work/head" || { echo "Refusing to resume: no Accept-Ranges: bytes." >&2 exit 2 } remote=$(awk 'tolower($1)=="content-length:" {gsub("\r",""); print $2}' \ "$work/head" | tail -n1) [[ $remote =~ ^[0-9]+$ ]] || { echo "Refusing to resume: no Content-Length." >&2; exit 2; } # Preflight: confirm a real 206 with the expected Content-Range. if (( remote > 0 )); then probe=$(curl -sS -D - -o /dev/null --max-time 30 \ -H 'Range: bytes=0-0' "$url") code=$(awk 'NR==1 {print $2}' <<<"$probe") [[ $code == 206 ]] || { echo "Range probe returned $code, not 206." >&2; exit 2; } grep -qi '^content-range:[[:space:]]*bytes 0-0/' <<<"$probe" || { echo "Range probe did not return Content-Range: bytes 0-0/..." >&2 exit 2 } fi part="$work/$name" if [[ -f $dest ]]; then local_size=$(stat -c %s "$dest") if (( local_size == remote )); then echo "Local file already has the remote length ($remote bytes)." part=$dest else mv "$dest" "$part" fi fi if [[ $part != "$dest" ]]; then wget --continue --no-http-keep-alive --tries=5 --timeout=30 \ --waitretry=10 -P "$work" "$url" [[ -f $part ]] || { echo "wget produced no output file." >&2; exit 3; } got=$(stat -c %s "$part") (( got == remote )) || { echo "Size mismatch: got $got, want $remote." >&2 exit 3 } mv "$part" "$dest" fi # Postflight: verify a published SHA-256 sidecar when available. if curl -fsS --max-time 30 "${base}.sha256" -o "$work/sum" 2>/dev/null; then want=$(awk '{print $1}' "$work/sum") got=$(sha256sum "$dest" | awk '{print $1}') [[ $want == "$got" ]] || { echo "Checksum mismatch." >&2; exit 4; } else echo "Warning: no ${base}.sha256; length checked, content unverified." >&2 fi success=1 echo "OK: $dest ($remote bytes)" A few design choices are deliberate:
- It refuses to resume when
Accept-Rangesis missing. Some servers support ranges without advertising them, but a conservative wrapper should not guess. If a server rejectsHEAD, replace the first probe with a rangedGETand parseContent-Range. - It moves the partial file into a side directory before resuming. That keeps the original name free and makes cleanup predictable. If the download fails, the working directory is preserved rather than deleted.
- It does not trust wget's exit status. The size and checksum checks decide whether the download is acceptable.
- It checks a
.sha256sidecar, not a checksum embedded in the URL. Adjust the sidecar URL to match your publisher's convention.
For the actual resume offset, run the same probe with bytes=$local_size- and expect Content-Range: bytes $local_size-.../N. A 416 there is the decision point: compare N with the local size. Equal means complete-by-length; different means stale or changed, and you should start a fresh download under a new name rather than resume.
Conclusion
A 416 Requested Range Not Satisfiable from wget -c is not proof that your file is complete. It means the range you asked for does not overlap the server's current resource. The useful evidence is the Content-Range: bytes */N value, compared with your local file size and, ideally, a published checksum.
Treat the four causes differently: an already-complete file can be verified and kept; a changed or shrunken remote file must be quarantined and re-downloaded; a server that ignores ranges needs a fresh download rather than a resume; and a keep-alive stall needs --no-http-keep-alive or a bounded timeout. Wrap the operation in a preflight that checks Accept-Ranges and a real 206 with a sane Content-Range, and a postflight that checks size and checksum. That way a misleading "success" from wget never becomes a corrupt archive in production.
