{"record":{"id":"8ccc8e8622de39b2","repo":"jdx/mise","slug":"invalid-checksum-format","errorCode":null,"errorMessage":"Invalid checksum format: {}","messagePattern":"Invalid checksum format: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/backend/static_helpers.rs","lineNumber":906,"sourceCode":"                \"Size mismatch: expected {}, got {}\",\n                expected_size,\n                actual_size\n            );\n        }\n    }\n\n    Ok(())\n}\n\npub(crate) fn verify_checksum_str(\n    file_path: &Path,\n    checksum: &str,\n    pr: Option<&dyn SingleReport>,\n) -> Result<()> {\n    if let Some((algo, hash_str)) = checksum.split_once(':') {\n        hash::ensure_checksum(file_path, hash_str, pr, algo)?;\n    } else {\n        bail!(\"Invalid checksum format: {}\", checksum);\n    }\n    Ok(())\n}\n\n/// File extensions that indicate non-binary files.\nconst SKIP_EXTENSIONS: &[&str] = &[\".txt\", \".md\", \".json\", \".yml\", \".yaml\"];\n\n/// File names (case-insensitive) that should be skipped when looking for executables.\nconst SKIP_FILE_NAMES: &[&str] = &[\"LICENSE\", \"README\"];\n\n/// Checks if a file should be skipped when searching for executables.\n///\n/// # Arguments\n/// * `file_name` - The file name to check\n/// * `strict` - If true, also checks against SKIP_FILE_NAMES and README.* patterns\n///\n/// # Returns\n/// * `true` if the file should be skipped (not a binary)","sourceCodeStart":888,"sourceCodeEnd":924,"githubUrl":"https://github.com/jdx/mise/blob/afd2eddd3a50c16190efc1c7e94404b48f72af57/src/backend/static_helpers.rs#L888-L924","documentation":"verify_checksum_str (src/backend/static_helpers.rs:906) expects a checksum string in \"<algorithm>:<hex-hash>\" form (e.g. \"sha256:abcd...\") and splits it on ':'. If no colon is present the string is not a parseable checksum and the tool bails, refusing to verify or guess the algorithm.","triggerScenarios":"A backend/config \"checksum\" value like \"d41d8cd98f00b204e9800998ecf8427e\" or \"sha256 abcd\" (space instead of colon) is passed to verify_checksum_str via verify_artifact.","commonSituations":"Hand-edited tool config or lockfile with a bare hash; copying a checksum line from an upstream checksums file that uses spaces; writing a custom backend template with the wrong checksum format.","solutions":["Rewrite the checksum to \"algo:hash\" form, e.g. \"sha256:<hex>\".","Check which algorithm the upstream project publishes (sha256/sha512/sha1) and prefix it accordingly.","If the value came from a lockfile or hand-edited config, regenerate it instead of editing manually.","If you wrote the backend/plugin, fix the checksum template to emit the algorithm prefix."],"exampleFix":"// before (config)\nchecksum = \"9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08\"\n// after\nchecksum = \"sha256:9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08\"","handlingStrategy":"validation","validationCode":"// validate checksum string before handing it to the backend\nfn is_valid_checksum(s: &str) -> bool {\n    s.split_once(':')\n        .map(|(algo, hash)| [\"sha256\", \"sha512\", \"sha1\", \"blake3\"].contains(&algo) && !hash.is_empty())\n        .unwrap_or(false)\n}","typeGuard":null,"tryCatchPattern":"match verify_artifact(&file, &checksum, pr) {\n    Err(e) if e.to_string().contains(\"Invalid checksum format\") => fix_checksum_format(&checksum)?,\n    other => other?,\n}","preventionTips":["Always write checksums as \"algo:hex\"; never paste bare hashes.","Copy checksums programmatically from upstream *sums files and add the algorithm prefix.","Let mise/lockfiles generate checksums instead of hand-editing them.","Add a lint in CI for custom backend configs checking checksum format."],"tags":["checksum","format","validation","configuration"],"backgroundTag":"invalid-argument-format","analyzedSha":"afd2eddd3a50c16190efc1c7e94404b48f72af57","analyzedAt":"2026-09-09T01:38:25.179Z","contentChangedAt":"2026-09-09T01:38:25.179Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}