{"record":{"id":"45940efdf9bf032e","repo":"jdx/mise","slug":"invalid-checksum-checksum-45940e","errorCode":null,"errorMessage":"Invalid checksum: {checksum}","messagePattern":"Invalid checksum: (.+?)","errorType":"validation","errorClass":"eyre::Report","httpStatus":null,"severity":"error","filePath":"src/backend/mod.rs","lineNumber":4043,"sourceCode":"\n        if let Some(checksum) = &locked.checksum {\n            ctx.pr.set_message(format!(\"checksum {filename}\"));\n            if let Some((algo, check)) = checksum.split_once(':') {\n                hash::ensure_checksum(file, check, Some(ctx.pr.as_ref()), algo).wrap_err_with(\n                    || {\n                        // Name the lock entry the expectation came from: a mismatch\n                        // usually means the entry describes a different artifact\n                        // than the one this machine downloads (e.g. a Swift build\n                        // for another Linux distro).\n                        let entry = self.describe_lock_entry(tv, &platform_key);\n                        match &locked.url {\n                            Some(url) => format!(\"{entry} locks {url}\"),\n                            None => entry,\n                        }\n                    },\n                )?;\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,","sourceCodeStart":4025,"sourceCodeEnd":4061,"githubUrl":"https://github.com/jdx/mise/blob/6f52dcdf99e282ef7a7db68c81301fa4618d0f79/src/backend/mod.rs#L4025-L4061","documentation":"During generic lockfile verification (Backend::install path in backend/mod.rs), mise validates a downloaded artifact's checksum stored in tv.lock_platforms. The string must be `algorithm:value` (split_once(':')); a checksum with no colon cannot name its hash algorithm, so it is rejected before any hashing — unlike a plain mismatch, which produces a richer lock-entry message.","triggerScenarios":"A mise.lock entry's checksum field contains a bare digest (no `blake3:`/`sha256:` prefix) — hand-edited lockfile, entries written by older/external tooling, or programmatically generated locks — and the corresponding tool is reinstalled while lockfile verification runs.","commonSituations":"Editing mise.lock to update a checksum from a release's SHA256SUMS file and forgetting the algorithm prefix; lockfile migrations or merges that mangle the field; scripts that regenerate lock entries with raw digests.","solutions":["Fix the entry to `algorithm:digest` form, e.g. `blake3:...` or `sha256:...`","Delete the tool's lock entry and run `mise lock` to regenerate it correctly","Treat mise.lock as generated output — re-lock instead of hand-editing checksums"],"exampleFix":"# before (mise.lock)\nchecksum = \"9a4f2c...\"\n# after\nchecksum = \"blake3:9a4f2c...\"","handlingStrategy":"validation","validationCode":"# preflight: all lockfile checksums must carry an algorithm prefix\nyq '.tools[].lock_platforms[].checksum' mise.lock | grep -vE '^[a-z0-9]+:' && echo 'bad checksum format' || echo ok","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Regenerate locks with `mise lock` instead of hand-editing checksum fields","Always store checksums as algorithm:digest","Validate mise.lock in CI before locked installs"],"tags":["checksum","lockfile","format-validation"],"backgroundTag":"invalid-checksum-format","analyzedSha":"6f52dcdf99e282ef7a7db68c81301fa4618d0f79","analyzedAt":"2026-08-22T10:14:23.840Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}