jdx/mise · error
invalid remote task cache key
Error message
invalid remote task cache key
What it means
validate_remote_key requires a remote task cache key to be exactly 64 characters of lowercase hex (a sha256-style digest). Any key that differs in length or contains characters outside [0-9a-f] is rejected, since keys are content digests by construction.
Solutions
- Compute the key as the lowercase hex sha256 digest of the cache inputs, and pass that exact string.
- Normalize the key before use: lowercase it and strip prefixes/whitespace.
- Check for truncation — a 32-char key is a half-written md5-style digest, not the required 64-char sha256 hex.
- If a custom producer writes keys, switch it to the same 64-hex digest scheme mise uses.
Example fix
// before
let key = format!("sha256:{:x}", digest); // prefixed, wrong format
// after
let key = hex::encode(Sha256::digest(inputs)); // 64 lowercase hex chars Defensive patterns
Strategy: validation
Validate before calling
const isValidKey = k => /^[0-9a-f]{64}$/.test(k);
if (!isValidKey(key)) throw new Error('key must be 64 lowercase hex chars'); Type guard
const isHex64 = (k) => typeof k === 'string' && /^[0-9a-f]{64}$/.test(k); Prevention
- Always derive keys as lowercase hex sha256 of inputs.
- Lowercase and strip prefixes/whitespace before passing keys.
- Never pass human-readable names as cache keys.
When it happens
Trigger: Calling the remote cache store (commit/get) with a key string that is not exactly 64 lowercase hex characters — e.g. an uppercase hash, a truncated hash, a prefixed key like "sha256:...", or a human-readable cache name.
Common situations: Custom cache-server integrations that generate their own key format; configuration pointing cache operations at user-supplied identifiers instead of computed digests; keys copied with surrounding whitespace or wrong casing.
Understand the failure class
Background: "invalid id" errors: invalid identifier format — why libraries reject IDs before lookup, and how to fix them — this error's family across 37 libraries.
Related errors
- remote cache directory contains duplicate names
- path must identify an output beneath the task directory
- path must not escape the task directory
- remote cache action keys must use blake3
- remote cache directory graph contains a cycle
AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17).
Data as JSON: /api/errors/52136fa4e88eac4c.
Report an issue: GitHub.
Appendix: source
Thrown at src/task/task_cache_store.rs:840
}
RestoredNode::Symlink { target, .. } => {
header.set_size(0);
archive.append_link(&mut header, path, target)?;
}
}
}
let encoder = archive.into_inner()?;
encoder.finish()?;
Ok(archive_file)
}
fn validate_remote_key(key: &str) -> Result<()> {
if key.len() != 64
|| !key
.bytes()
.all(|byte| byte.is_ascii_digit() || (b'a'..=b'f').contains(&byte))
{
bail!("invalid remote task cache key");
}
Ok(())
}
pub(crate) struct LocalTaskCacheStore {
root: PathBuf,
}
impl LocalTaskCacheStore {
pub(crate) fn new(root: PathBuf) -> Self {
Self { root }
}
fn paths(&self, key: &str) -> (PathBuf, PathBuf) {
(
self.root.join(format!("{key}.tar.zst")),
self.root.join(format!("{key}.json")),
)View on GitHub (pinned to 533346cc37)