{"record":{"id":"4e8d73e385f324ec","repo":"jdx/mise","slug":"task-cache-manifest-does-not-match-cache-key","errorCode":null,"errorMessage":"task cache manifest does not match cache key","messagePattern":"task cache manifest does not match cache key","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/task/task_cache.rs","lineNumber":724,"sourceCode":"        if self.limits.configured()\n            && let Err(err) = enforce_task_cache_limits(&self.cache_dir, self.limits)\n        {\n            warn!(\n                \"failed to enforce task cache limits in {}: {err}\",\n                self.cache_dir.display()\n            );\n        }\n        Ok(())\n    }\n\n    fn entry_lock(&self) -> Result<fslock::LockFile> {\n        task_cache_entry_lock(&self.cache_dir, &self.key)\n    }\n\n    fn read_manifest(&self, contents: &[u8]) -> Result<CacheManifest> {\n        let manifest: CacheManifest = serde_json::from_slice(contents)?;\n        if manifest.format != CACHE_FORMAT_VERSION || manifest.key != self.key {\n            bail!(\"task cache manifest does not match cache key\");\n        }\n        Ok(manifest)\n    }\n}\n\nfn cleanup_abandoned_partial_writes_once(cache_dir: &Path) {\n    if !cache_dir.is_dir() {\n        return;\n    }\n    let should_clean = CLEANED_PARTIAL_CACHE_DIRS\n        .lock()\n        .unwrap_or_else(|err| err.into_inner())\n        .insert(cache_dir.to_path_buf());\n    if should_clean && let Err(err) = cleanup_abandoned_partial_writes(cache_dir) {\n        CLEANED_PARTIAL_CACHE_DIRS\n            .lock()\n            .unwrap_or_else(|err| err.into_inner())\n            .remove(cache_dir);","sourceCodeStart":706,"sourceCodeEnd":742,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/task/task_cache.rs#L706-L742","documentation":"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.","triggerScenarios":"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.","commonSituations":"Cache directories reused across mise versions with changed format constants; key-collision or sloppy copying of manifests between entries; manually moved/sharded remote caches.","solutions":["Delete the mismatched entry (or the whole task-artifacts cache dir) and rerun the task.","Use a matching mise version so CACHE_FORMAT_VERSION agrees with the stored manifests.","Don't hand-copy manifests between cache entries; keys are content-derived and must match.","If a shared remote cache, ensure it's namespaced per mise version/format."],"exampleFix":"// before\n~/.cache/mise/task-artifacts/v1/<key-of-old-inputs>/manifest.json with stale key\n// after\nrm -rf ~/.cache/mise/task-artifacts && mise run build  # fresh manifest keyed to current inputs","handlingStrategy":"fallback","validationCode":"const m = JSON.parse(fs.readFileSync(p, 'utf8'));\nif (m.key !== expectedKey || m.format !== expectedFormat) { /* treat as miss */ }","typeGuard":"function manifestMatches(m: { format: number; key: string }, key: string, format: number): boolean {\n  return m.format === format && m.key === key;\n}","tryCatchPattern":"// treat key mismatch as a cache miss\nmatch read_manifest(bytes) {\n    Err(_) => None, // miss -> execute task\n    Ok(m) => Some(m),\n}","preventionTips":["Never move or copy manifests between cache entries","Namespace shared remote caches by mise version","Purge cache dirs when switching mise versions"],"tags":["task-cache","manifest","key-mismatch"],"backgroundTag":"checksum-mismatch","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"}