{"record":{"id":"de023c8acd737093","repo":"jdx/mise","slug":"server-returned-inconsistent-partial-content","errorCode":null,"errorMessage":"server returned inconsistent partial content","messagePattern":"server returned inconsistent partial content","errorType":"http","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/http.rs","lineNumber":1170,"sourceCode":"                        }\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 {\n                            bail!(\"server returned inconsistent partial content\");\n                        }\n                        restarted_without_resume = true;\n                        continue;\n                    }\n                    // Keep the filename associated with the bytes already on disk.\n                    // A redirect target may change between requests even when the\n                    // server accepts the validator and Range header. Replacing the\n                    // stored hint could make the completed bytes use a different\n                    // archive format than the response that started the partial.\n                    let effective_filename = state.effective_filename;\n                    let validator = validator.unwrap_or(state.validator);\n                    (\n                        offset,\n                        Some(total),\n                        Some(validator),\n                        true,\n                        effective_filename,\n                    )","sourceCodeStart":1152,"sourceCodeEnd":1188,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/http.rs#L1152-L1188","documentation":"When resuming a download, mise cross-checks the server's 206 response against the recorded resume state: total length, ETag/Last-Modified validator, and returned byte range. Any inconsistency (plus a prior no-resume restart having occurred) means the remote file changed or the state is stale, so it clears the partial and bails.","triggerScenarios":"A resumed download where Content-Range total differs from the recorded total, the response validator (ETag/Last-Modified) doesn't match the stored one, or the returned range doesn't line up with the resume offset — after a retry without resume already happened.","commonSituations":"Upstream replaced the artifact between the original partial download and the resume (version re-released); load balancer serving different file copies without stable ETags; stale partial from an old install attempt.","solutions":["Delete the partial download for that artifact and start the download fresh so state is rebuilt against the current file.","Retry later if upstream is mid-release and the artifact is changing under you.","Use a mirror that serves byte-identical artifacts with stable ETags/Last-Modified."],"exampleFix":"// before\n$ mise install node@22    # fails mid-resume: inconsistent partial content\n// after: clear the stale partial and reinstall\n$ rm -rf ~/.cache/mise/downloads/*node*22* && mise install node@22","handlingStrategy":"validation","validationCode":"etag=$(curl -fsSI \"$url\" | grep -i '^etag:' | head -1)\n[ \"$etag\" = \"$stored_etag\" ] || { rm -f \"$partial\"; echo \"remote changed; clearing partial\"; }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Clear partial downloads when upstream re-releases the same version","Prefer mirrors with stable ETags/Last-Modified across replicas","Never hand-edit partial download state"],"tags":["http","download","resume","integrity"],"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"}