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 stored manifest JSON and requires both the format version and the embedded key to match the cache key being looked up. A mismatch means the manifest belongs to a different task/input fingerprint or an incompatible format, so it cannot be trusted for this request.

Solutions

  1. Delete the mismatched entry (or the whole task-artifacts cache dir) and rerun the task.
  2. Use a matching mise version so CACHE_FORMAT_VERSION agrees with the stored manifests.
  3. Don't hand-copy manifests between cache entries; keys are content-derived and must match.
  4. If a shared remote cache, ensure it's namespaced per mise version/format.

Example fix

// before
~/.cache/mise/task-artifacts/v1/<key-of-old-inputs>/manifest.json with stale key
// after
rm -rf ~/.cache/mise/task-artifacts && mise run build  # fresh manifest keyed to current inputs
Defensive patterns

Strategy: fallback

Validate before calling

const m = JSON.parse(fs.readFileSync(p, 'utf8'));
if (m.key !== expectedKey || m.format !== expectedFormat) { /* treat as miss */ }

Type guard

function manifestMatches(m: { format: number; key: string }, key: string, format: number): boolean {
  return m.format === format && m.key === key;
}

Try / catch

// treat key mismatch as a cache miss
match read_manifest(bytes) {
    Err(_) => None, // miss -> execute task
    Ok(m) => Some(m),
}

Prevention

When it happens

Trigger: Loading a cache entry's manifest (read_manifest) during cache lookup when manifest.format != CACHE_FORMAT_VERSION or manifest.key != self.key — e.g. the wrong manifest file sits at the expected path, or the store format changed.

Common situations: Cache directories reused across mise versions with changed format constants; key-collision or sloppy copying of manifests between entries; manually moved/sharded remote caches.

Understand the failure class

Background: Checksum mismatch errors: "checksum verification failed", "digest mismatch", "expected vs actual checksum" — what they mean and how to fix them — this error's family across 41 libraries.

Related errors


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

Appendix: source

Thrown at src/task/task_cache.rs:724

        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 533346cc37)