{"record":{"id":"1bf11274e91962ba","repo":"jdx/mise","slug":"server-returned-an-invalid-content-range-response","errorCode":null,"errorMessage":"server returned an invalid Content-Range response","messagePattern":"server returned an invalid Content-Range response","errorType":"http","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/http.rs","lineNumber":1151,"sourceCode":"                if resp.status() == StatusCode::PARTIAL_CONTENT {\n                    let Some((state, _)) = resume else {\n                        partial.clear()?;\n                        if !restarted_without_resume {\n                            restarted_without_resume = true;\n                            continue;\n                        }\n                        bail!(\"server returned partial content without a resumable request\");\n                    };\n                    let content_range = resp\n                        .headers()\n                        .get(CONTENT_RANGE)\n                        .and_then(|value| value.to_str().ok())\n                        .and_then(parse_content_range);\n                    let Some(ParsedContentRange::Bytes { start, end, total }) = content_range\n                    else {\n                        partial.clear()?;\n                        if restarted_without_resume {\n                            bail!(\"server returned an invalid Content-Range response\");\n                        }\n                        restarted_without_resume = true;\n                        continue;\n                    };\n                    let validator = response_validator(resp.headers());\n                    let response_length_matches = resp\n                        .content_length()\n                        .is_none_or(|length| length == end - start + 1);\n                    if start != offset\n                        || end + 1 != total\n                        || !response_length_matches\n                        || state.total_size.is_some_and(|expected| expected != total)\n                        || validator\n                            .as_ref()\n                            .is_some_and(|value| !value.matches(&state.validator))\n                    {\n                        partial.clear()?;\n                        if restarted_without_resume {","sourceCodeStart":1133,"sourceCodeEnd":1169,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/http.rs#L1133-L1169","documentation":"On resume, mise sends a Range request and expects a valid bytes-based Content-Range header describing the returned slice. If the header is missing, malformed, or a non-bytes unit (e.g. */total), and a previous no-resume restart already occurred, it bails with this error after clearing the partial.","triggerScenarios":"A resumed download where the server's 206 response lacks a parseable bytes Content-Range (missing header, 'Content-Range: bytes */N' for unsatisfied ranges, or garbage syntax) and the retry-without-resume path also failed the same way.","commonSituations":"Server or proxy that supports 206 but omits/mangles Content-Range; range requests answered by a cache layer with inconsistent headers; servers responding to out-of-range resumes with the unparseable 'bytes */total' form.","solutions":["Bypass/fix the proxy or server middleware so Range responses include a valid 'Content-Range: bytes start-end/total' header.","Clear the partial download and retry from scratch (or from a different mirror).","If the resume offset is beyond the file size (server returns */total), remove the stale partial so the next request starts fresh."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"curl -fsSI -H 'Range: bytes=10-19' \"$url\" | grep -i '^content-range: bytes ' || echo \"invalid/missing Content-Range\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Confirm the download source returns 'Content-Range: bytes start-end/total' on 206s","Clear stale partials whose offset may exceed the current file size","Avoid proxies that strip or rewrite response headers"],"tags":["http","download","range-requests","headers"],"backgroundTag":"unexpected-response-shape","analyzedSha":"533346cc374382b41ec5ff70536252b2e96e725c","analyzedAt":"2026-09-17T13:35:38.149Z","contentChangedAt":"2026-09-17T13:35:38.149Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}