jdx/mise · error

task cache manifest does not match cache key

Error message

task cache manifest does not match cache key

What it means

read_manifest deserializes the entry's manifest but then requires manifest.format == CACHE_FORMAT_VERSION (2) and manifest.key == this entry's key. Either mismatch means the manifest does not belong to this entry/format — a stale entry from an older mise, a copied/misplaced manifest, or corruption — so the restore aborts.

Source

Thrown at src/task/task_cache.rs:725

        if self.limits.configured()
            && let Err(err) = enforce_task_cache_limits(&self.cache_dir, self.limits)
        {
            warn!(
                "failed to enforce task cache limits in {}: {err}",
                self.cache_dir.display()
            );
        }
        Ok(())
    }

    fn entry_lock(&self) -> Result<fslock::LockFile> {
        task_cache_entry_lock(&self.cache_dir, &self.key)
    }

    fn read_manifest(&self, contents: &[u8]) -> Result<CacheManifest> {
        let manifest: CacheManifest = serde_json::from_slice(contents)?;
        if manifest.format != CACHE_FORMAT_VERSION || manifest.key != self.key {
            bail!("task cache manifest does not match cache key");
        }
        Ok(manifest)
    }
}

fn cleanup_abandoned_partial_writes_once(cache_dir: &Path) {
    if !cache_dir.is_dir() {
        return;
    }
    let should_clean = CLEANED_PARTIAL_CACHE_DIRS
        .lock()
        .unwrap_or_else(|err| err.into_inner())
        .insert(cache_dir.to_path_buf());
    if should_clean && let Err(err) = cleanup_abandoned_partial_writes(cache_dir) {
        CLEANED_PARTIAL_CACHE_DIRS
            .lock()
            .unwrap_or_else(|err| err.into_inner())
            .remove(cache_dir);

View on GitHub (pinned to 6f52dcdf99)

Solutions

  1. Clear the task cache directory and re-run the task to rebuild entries in the current format
  2. Upgrade any machine still writing the old format so all writers share one mise version
  3. Avoid copying/moving individual entry directories; delete and let mise recreate them
  4. Report a bug if a single fresh mise version reproduces it on a newly written entry

Example fix

# shell
rm -rf "${XDG_CACHE_HOME:-$HOME/.cache}/task-artifacts"
mise run build
Defensive patterns

Strategy: fallback

Validate before calling

mise --version
jq -r '.format, .key' ~/.cache/task-artifacts/v2/*/manifest.json 2>/dev/null | sort -u  # inspect formats present

Try / catch

On mismatch, delete the stale entry or the whole cache dir and re-run; do not retry unchanged — the format/key will not heal itself.

Prevention

When it happens

Trigger: Cache entries written by an older mise using format version 1 now read by a version expecting 2; a manifest file moved between entry directories; the entry's key directory renamed so self.key no longer matches the embedded key field.

Common situations: Upgrading mise and reusing the old cache dir (the versioned 'v2' path mitigates but remote stores may not); manually pruning or relocating cache entries; sync tools (Dropbox/rsync) mixing manifests across machines with different mise versions.

Related errors


AI-assisted analysis of jdx/mise@6f52dcdf99 (2026-08-22). Data as JSON: /api/errors/4e8d73e385f324ec. Report an issue: GitHub.