jdx/mise · error

invalid remote cache digest

Error message

invalid remote cache digest

What it means

Digest::validate found the hash field of a remote-cache descriptor is not 64 lowercase hexadecimal characters (wrong length or non-hex characters like uppercase or a '0x' prefix). The digest is treated as corrupt/untrusted and rejected before any cache hit or upload.

Solutions

  1. Send the raw lowercase hex digest produced by blake3/sha256 with no prefix
  2. Check for truncation or re-encoding of the hash between client and server
  3. Regenerate the descriptor if the entry was hand-edited
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/mise-cache-core/src/lib.rs:128 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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

Appendix: source

Thrown at crates/mise-cache-core/src/lib.rs:128

        let (hash, size) = hash_file_blake3(path)?;
        Ok(Self {
            algorithm: "blake3".into(),
            hash,
            size,
        })
    }

    pub fn validate(&self) -> Result<()> {
        if self.algorithm != "blake3" && self.algorithm != "sha256" {
            bail!("unsupported remote cache digest algorithm");
        }
        if self.hash.len() != 64
            || !self
                .hash
                .bytes()
                .all(|byte| byte.is_ascii_digit() || (b'a'..=b'f').contains(&byte))
        {
            bail!("invalid remote cache digest");
        }
        Ok(())
    }

    pub fn matches_bytes(&self, bytes: &[u8]) -> Result<bool> {
        self.validate()?;
        if self.size != bytes.len() as u64 {
            return Ok(false);
        }
        let hash = match self.algorithm.as_str() {
            "blake3" => blake3::hash(bytes).to_hex().to_string(),
            "sha256" => hex::encode(sha2::Sha256::digest(bytes)),
            _ => unreachable!("digest algorithm was validated"),
        };
        Ok(self.hash == hash)
    }

    pub fn matches_file(&self, path: &Path) -> Result<bool> {

View on GitHub (pinned to 533346cc37)