{"record":{"id":"94543fb1e3212413","repo":"jdx/mise","slug":"size-mismatch-for-expected-got-94543f","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/mod.rs","lineNumber":4059,"sourceCode":"                )?;\n            } else {\n                bail!(\"Invalid checksum: {checksum}\");\n            }\n        } else if lockfile_enabled {\n            ctx.pr.set_message(format!(\"generate checksum {filename}\"));\n            let hash = hash::file_hash_blake3(file, Some(ctx.pr.as_ref()))?;\n            tv.lock_platforms\n                .entry(platform_key.clone())\n                .or_default()\n                .checksum = Some(format!(\"blake3:{hash}\"));\n        }\n\n        // Handle size verification and generation\n        if let Some(expected_size) = locked.size {\n            ctx.pr.set_message(format!(\"verify size {filename}\"));\n            let actual_size = file.metadata()?.len();\n            if actual_size != expected_size {\n                bail!(\n                    \"Size mismatch for {}: expected {}, got {}\",\n                    filename,\n                    expected_size,\n                    actual_size\n                );\n            }\n        } else if lockfile_enabled {\n            tv.lock_platforms.entry(platform_key).or_default().size = Some(file.metadata()?.len());\n        }\n        Ok(())\n    }\n\n    /// Human-readable identity of the lock entry consulted for `tv` on\n    /// `platform_key`, including the options that distinguish artifact variants.\n    fn describe_lock_entry(&self, tv: &ToolVersion, platform_key: &str) -> String {\n        let options = self\n            .resolve_lockfile_options(&tv.request, &PlatformTarget::from_current())\n            .unwrap_or_default();","sourceCodeStart":4041,"sourceCodeEnd":4077,"githubUrl":"https://github.com/jdx/mise/blob/6f52dcdf99e282ef7a7db68c81301fa4618d0f79/src/backend/mod.rs#L4041-L4077","documentation":"Generic lockfile verification: after download, mise compares the artifact's actual byte length against `locked.size` recorded in mise.lock for the current platform. Any difference means the file on disk is not the exact locked artifact, so the install aborts to preserve reproducibility; when no size is recorded and lockfile is enabled, the size is generated instead.","triggerScenarios":"Reinstalling a tool under lockfile verification when the downloaded artifact's length differs from mise.lock's recorded size — upstream re-published the asset, a truncated/cached partial download, or a lock entry generated from a different artifact variant (platform/arch/tag mismatch).","commonSituations":"Upstream silently replaces release assets without a version bump; interrupted downloads leaving truncated files in mise's cache; lockfiles generated against different asset selection (renamed release files); proxy/CDN serving different content lengths.","solutions":["Clear the download cache and retry: `mise cache clean` (or remove the tool's cache dir) to eliminate truncated files","Regenerate the lock entries with `mise lock` so sizes match current assets, then commit mise.lock","If the upstream asset genuinely changed under the same version, pin a different, immutable version"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"mise install --locked || (mise cache clean && mise lock && mise install --locked)","preventionTips":["Clear mise's download cache after interrupted installs before verifying locks","Re-lock immediately after changing tool versions so size fields stay current","Prefer immutable release artifacts (content-addressed or never-replaced assets)"],"tags":["size-mismatch","lockfile","artifact-integrity"],"backgroundTag":"artifact-integrity-mismatch","analyzedSha":"6f52dcdf99e282ef7a7db68c81301fa4618d0f79","analyzedAt":"2026-08-22T10:14:23.840Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}