{"record":{"id":"bb096f77fc103092","repo":"jdx/mise","slug":"invalid-remote-cache-digest","errorCode":null,"errorMessage":"invalid remote cache digest","messagePattern":"invalid remote cache digest","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/mise-cache-core/src/lib.rs","lineNumber":128,"sourceCode":"        let (hash, size) = hash_file_blake3(path)?;\n        Ok(Self {\n            algorithm: \"blake3\".into(),\n            hash,\n            size,\n        })\n    }\n\n    pub fn validate(&self) -> Result<()> {\n        if self.algorithm != \"blake3\" && self.algorithm != \"sha256\" {\n            bail!(\"unsupported remote cache digest algorithm\");\n        }\n        if self.hash.len() != 64\n            || !self\n                .hash\n                .bytes()\n                .all(|byte| byte.is_ascii_digit() || (b'a'..=b'f').contains(&byte))\n        {\n            bail!(\"invalid remote cache digest\");\n        }\n        Ok(())\n    }\n\n    pub fn matches_bytes(&self, bytes: &[u8]) -> Result<bool> {\n        self.validate()?;\n        if self.size != bytes.len() as u64 {\n            return Ok(false);\n        }\n        let hash = match self.algorithm.as_str() {\n            \"blake3\" => blake3::hash(bytes).to_hex().to_string(),\n            \"sha256\" => hex::encode(sha2::Sha256::digest(bytes)),\n            _ => unreachable!(\"digest algorithm was validated\"),\n        };\n        Ok(self.hash == hash)\n    }\n\n    pub fn matches_file(&self, path: &Path) -> Result<bool> {","sourceCodeStart":110,"sourceCodeEnd":146,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/crates/mise-cache-core/src/lib.rs#L110-L146","documentation":"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.","triggerScenarios":"Thrown at crates/mise-cache-core/src/lib.rs:128 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Send the raw lowercase hex digest produced by blake3/sha256 with no prefix","Check for truncation or re-encoding of the hash between client and server","Regenerate the descriptor if the entry was hand-edited"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"533346cc374382b41ec5ff70536252b2e96e725c","analyzedAt":"2026-09-17T13:35:38.149Z","contentChangedAt":"2026-09-17T13:35:38.149Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}