Diagnosing Failed Downloads: Codes, Truncation, Corruption

Diagnosing Failed Downloads: Codes, Truncation, Corruption
Technical Specifications & Compatibility
Resume Status Code 206 Partial Content with a Content-Range header
Range Rejected Code 416 Range Not Satisfiable when the offset exceeds the file size
Length Headers Content-Length for total bytes, Content-Range for the offset and total
Chunked Framing Transfer-Encoding chunked, terminated by a zero-length chunk
Truncation Error net::ERR_CONTENT_LENGTH_MISMATCH in Chromium browsers
Verification Digest SHA-256, 64 hexadecimal characters
Table of Contents

A download that ends with an error is not one failure but a stack of them. The browser prints one line, the server answered with a status code, the network carried some number of bytes, and the file on disk may not have the promised length. Separating those layers is the whole exercise: once you know which one broke, the next attempt stops being guesswork.

What each status code actually reports

An HTTP status describes the server's answer to one request, not the health of the file. A 403 and a 404 look identical in a browser, yet they name different owners of the problem: the first is a permission or token issue, the second a missing resource.

CodeWhat the server saysTypical cause during a transferWhat to do
403I understood you and I refuseSigned URL expired, or bound to another IP or sessionRegenerate the link from the page that issued it
404No resource at this pathLink truncated when copied, file renamed, share removedCompare the link character by character
410It existed and will not returnShare explicitly deleted by its ownerAsk the sender for a new copy
429Too many requestsRate limit per address or per accountWait the interval in Retry-After
503Temporarily unable to serveMaintenance or an overloaded edge nodeRetry with backoff, never in a tight loop

A 403 on resume is nearly always an expired signed URL: hosts bind tokens to a session, an address range or a time window. A 429 counts requests, not bytes, so retrying at once prolongs the block. Respect Retry-After; if absent, wait a minute.

Truncated is not the same as corrupt

Truncation means fewer bytes arrived than the file contains. Corruption means the same number of bytes arrived, with different values. A truncated archive fails loudly: 7-Zip, WinRAR and unzip report Unexpected end of archive or CRC failed, and the size on disk is visibly short.

Corruption is quieter. A large archive can land with exactly the expected size and still be unusable, because a bit flipped in a block or a proxy re-encoded part of the stream. Content-Length cannot see any of that: it counts bytes and nothing else. A SHA-256 digest can, because it depends on every byte in order.

Size is a necessary check, never a sufficient one. A file can arrive exactly as long as promised and still differ from the original in a single block.

Compare the byte count first, since it is instant, then compute a hash before trusting the contents. The checksum verifier does the second step inside the browser, without uploading anything.

Chunked responses and the errors that name them

When the server does not know the final length in advance, it sends Transfer-Encoding: chunked instead of Content-Length and closes the body with a zero-length chunk. That terminator is the receipt: if the connection dies first, Chromium reports net::ERR_INCOMPLETE_CHUNKED_ENCODING, which means the framing was never closed.

net::ERR_CONTENT_LENGTH_MISMATCH is the other family: the response declared a length and delivered a different number of bytes. Both surface as network failures and usually come from something in the middle, not the origin: a proxy that cuts the response at a size cap, a scanner that stalls the stream, or an idle timeout shorter than the transfer.

The test is repetition along another path: the same URL through a phone hotspot, or curl -o file.bin URL. If the failure disappears, the origin is fine and the intermediary is the suspect.

Range requests: what a real resume looks like

Resumption is not a browser feature; it is a server capability advertised with Accept-Ranges: bytes. A client asks for the rest with Range: bytes=5242880-, and a compliant server answers 206 Partial Content with Content-Range: bytes 5242880-10485759/10485760. The number after the slash is the full size, the value to compare against your own file.

Two failures are common. A server that ignores the header answers 200 OK and sends the file from the beginning; appending that to a partial file yields a copy longer than the original and a hash that will never match. And 416 Range Not Satisfiable means the offset lies beyond the end of the resource, which happens when the local partial file is larger than the remote one, usually because the file was replaced between attempts.

With curl, the flag -C - reads the current size and asks only for the remainder. In a browser, close the tab before retrying: some managers restart the transfer silently.

Scanners and proxies in the middle

Antivirus software with real-time protection opens a file while the browser is still writing it. On Windows this can raise a sharing violation reported as a failed download, even though every byte arrived. The symptom is distinctive: the progress bar reaches the end, then the transfer errors.

Corporate proxies add their own layer. TLS inspection re-signs the connection, content filters scan archives up to a configured size and truncate the rest, and some strip Range headers entirely, disabling resumption without a message. If downloads fail only inside one network, the proxy is the first hypothesis.

A decision tree that ends with a hash

  1. Read the status code, not the browser message: 4xx points at the link or token, 5xx or 429 at the server.
  2. For 404 or 410, stop retrying: the resource is not there.
  3. For 403, regenerate the link from the page you started from instead of reusing a copied URL.
  4. For 429 or 503, wait the interval given in Retry-After and retry once. A second failure is not transient.
  5. If the transfer started and died, compare the bytes on disk with Content-Length and resume from that offset.
  6. If the size matches but the file will not open, compare its SHA-256 with the published value: a mismatch at the right length is corruption.
  7. If it fails on one network only, test from another before changing local settings.

Most failed downloads are decided by facts the browser already knows and does not show: the status code, the declared length, the bytes written. Reading those three before retrying turns a cycle of attempts into one diagnosis. When they agree and the content still fails, the problem has moved from the transfer to the file, and repairing a corrupted archive explains what each format can recover.

Troubleshooting Common Issues

Error / Issue Technical Cause Step-by-Step Fix
net::ERR_CONTENT_LENGTH_MISMATCH at the end of the transfer The connection or an intermediary closed the body before the declared number of bytes arrived. Compare the size on disk with Content-Length, then resume from that offset with curl -C - instead of restarting.
net::ERR_INCOMPLETE_CHUNKED_ENCODING A chunked response lost its terminating zero-length chunk, usually cut by a proxy, a scanner or an idle timeout. Repeat the transfer on another network or outside the proxy; if it succeeds, the intermediary is the cause.
416 Range Not Satisfiable when resuming The partial local file is larger than the remote resource, typically because the file was replaced. Delete the partial file and start a clean transfer with a fresh link.
Unexpected end of archive in 7-Zip or WinRAR The archive is truncated, so its central directory is missing or incomplete. Check the byte count against the published size and resume the transfer; only then attempt a repair.

Frequently Asked Questions

Does an HTTP 403 mean the file was deleted?

No. A 403 says the server refuses this request, which in a file host almost always means the signed URL expired or was bound to another session or IP address. A 404 or a 410 is the code that indicates the resource is missing.

Can a cancelled download be resumed?

Only if the server advertises Accept-Ranges and answers a Range request with 206. If it replies 200 OK it is sending the file from the start, so appending that data to a partial file produces a longer, unusable copy.

Is a file with the correct size always intact?

No. Corruption preserves length: a flipped bit, a re-encoded block or a substituted build all keep the same byte count. Only a hash such as SHA-256 reveals the difference, which is why size checks come first and never last.

Why do downloads fail only on my office network?

Because the proxy in that network inspects or buffers the response. TLS inspection, archive scanning with a size cap and idle timeouts shorter than the transfer all break large files while leaving small ones untouched.

Related Technical Guides