{"record":{"id":"e8531ca133fed4d0","repo":"jdx/mise","slug":"size-mismatch-for-expected-got","errorCode":null,"errorMessage":"Size mismatch for {}: expected {}, got {}","messagePattern":"Size mismatch for (.+?): expected (.+?), got (.+?)","errorType":"exception","errorClass":"eyre::Report","httpStatus":null,"severity":"error","filePath":"src/backend/github.rs","lineNumber":1597,"sourceCode":"        artifact: &mut ArtifactInfo,\n    ) -> Result<()> {\n        let filename = file_path.file_name().unwrap_or_default().to_string_lossy();\n        if let Some(checksum) = &artifact.checksum {\n            ctx.pr.set_message(format!(\"checksum {filename}\"));\n            let Some((algorithm, expected)) = checksum.split_once(':') else {\n                eyre::bail!(\"Invalid checksum: {checksum}\");\n            };\n            crate::hash::ensure_checksum(file_path, expected, Some(ctx.pr.as_ref()), algorithm)?;\n        } else if Settings::get().lockfile_enabled() {\n            ctx.pr.set_message(format!(\"generate checksum {filename}\"));\n            let hash = crate::hash::file_hash_blake3(file_path, Some(ctx.pr.as_ref()))?;\n            artifact.checksum = Some(format!(\"blake3:{hash}\"));\n        }\n\n        if let Some(expected_size) = artifact.size {\n            let actual_size = file_path.metadata()?.len();\n            if actual_size != expected_size {\n                eyre::bail!(\n                    \"Size mismatch for {}: expected {}, got {}\",\n                    filename,\n                    expected_size,\n                    actual_size\n                );\n            }\n        } else if Settings::get().lockfile_enabled() {\n            artifact.size = Some(file_path.metadata()?.len());\n        }\n        Ok(())\n    }\n\n    fn install_additional_archive(\n        &self,\n        install_path: &Path,\n        file_path: &Path,\n        pr: Option<&dyn crate::ui::progress_report::SingleReport>,\n    ) -> Result<()> {","sourceCodeStart":1579,"sourceCodeEnd":1615,"githubUrl":"https://github.com/jdx/mise/blob/6f52dcdf99e282ef7a7db68c81301fa4618d0f79/src/backend/github.rs#L1579-L1615","documentation":"After downloading an additional artifact for a github: tool, mise compares the file's byte length against `artifact.size` recorded in the lock entry. A difference means the downloaded asset is not the exact artifact the lockfile describes — either the upstream asset changed or the wrong asset was fetched.","triggerScenarios":"A github release asset was re-uploaded or silently changed after `mise lock` recorded its size; a cached partial download; or the lockfile was generated against a different asset variant (platform/arch) than the one matched at install time.","commonSituations":"Upstream maintainer re-pushes a tag/release without a version bump; shared mise.lock across platforms where pattern matching picks different assets; flaky network leaving a truncated file in the download cache.","solutions":["Clear the cached download and retry (`mise cache clean` or remove the tool's cache dir) to rule out a truncated file","Regenerate the lock entry: `mise lock` (or delete the tool's mise.lock section first) so size matches the current asset","Verify upstream: if the release asset really changed without a version bump, pin a different, stable version"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"# compare local artifact size to the lock entry before relying on it\nstat -c%s <cached-file>   # vs size field in mise.lock","typeGuard":null,"tryCatchPattern":"mise install --locked || (mise cache clean && mise install --locked)","preventionTips":["Run `mise cache clean` after network interruptions before locked installs","Regenerate mise.lock after pinning new versions instead of reusing old entries","Pin immutable release tags/versions so upstream re-uploads cannot shift sizes"],"tags":["size-mismatch","lockfile","artifact-integrity","github-backend"],"backgroundTag":"artifact-integrity-mismatch","analyzedSha":"6f52dcdf99e282ef7a7db68c81301fa4618d0f79","analyzedAt":"2026-08-22T10:14:23.840Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}