jdx/mise · error

Unknown checksum algorithm

Error message

Unknown checksum algorithm: {}

What it means

ensure_checksum in src/hash.rs computes a file's digest and compares it to an expected checksum string. The algorithm is selected by matching the prefix before ':' in the checksum; if the named algorithm isn't one of the supported ones (e.g. sha256, sha1, md5), it bails with this error.

Solutions

  1. Use a supported algorithm name: sha256, sha384, sha512, sha1, or md5 (lowercase, no spaces) before the colon.
  2. Recompute the digest with sha256sum if the source only publishes an unsupported algorithm, and store that value instead.
  3. Check for typos or stray whitespace in the checksum string in your mise.toml / lockfile.

Example fix

// before (mise.toml)
checksum = "sha512:abc123..."
// after
checksum = "sha256:9f2c1a..."
Defensive patterns

Strategy: validation

Validate before calling

case "${checksum%%:*}" in
  sha256|sha384|sha512|sha1|md5) echo ok ;;
  *) echo "unsupported algorithm: ${checksum%%:*}" >&2; exit 1 ;;
esac

Prevention

When it happens

Trigger: Passing a checksum string like 'sha512:...' or a misspelled algorithm ('SHA 256:...', 'sh256:...') to ensure_checksum, which is invoked from checksum verification paths (e.g. corepack checksum tests/verification).

Common situations: Typo in the algorithm name in a config or lockfile entry; a tool's published checksum uses an algorithm mise doesn't support; copying a checksum line that includes extra qualifiers.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17). Data as JSON: /api/errors/6cb0de20122ae0de. Report an issue: GitHub.

Appendix: source

Thrown at src/hash.rs:130

        "sha224" => file_hash_prog::<Sha224>(path, pr)?,
        "sha384" => file_hash_prog::<Sha384>(path, pr)?,
        "sha1" => {
            if use_external_hasher && file::which("sha1sum").is_some() {
                let out = cmd!("sha1sum", path).read()?;
                out.split_whitespace().next().unwrap().to_string()
            } else {
                file_hash_prog::<Sha1>(path, pr)?
            }
        }
        "md5" => {
            if use_external_hasher && file::which("md5sum").is_some() {
                let out = cmd!("md5sum", path).read()?;
                out.split_whitespace().next().unwrap().to_string()
            } else {
                file_hash_prog::<Md5>(path, pr)?
            }
        }
        _ => bail!("Unknown checksum algorithm: {}", algo),
    };
    let checksum = checksum.to_lowercase();
    if actual != checksum {
        bail!(
            "Checksum mismatch for file {}:\nExpected: {algo}:{checksum}\nActual:   {algo}:{actual}",
            display_path(path)
        );
    }
    Ok(())
}

pub(crate) fn parse_shasums(text: &str) -> HashMap<String, String> {
    text.lines()
        .filter_map(|l| {
            let mut parts = l.split_whitespace();
            let hash = parts.next()?;
            let name = parts.next()?;
            // Strip coreutils binary-mode marker (e.g. "<hash> *file.tar.gz").

View on GitHub (pinned to 533346cc37)