jdx/mise · error
task cache manifest contains duplicate or nested roots
Error message
task cache manifest contains duplicate or nested roots
What it means
A cache-hit manifest lists the root directories (relative paths) that the archived artifact should restore. Before restoring, mise verifies the manifest's roots contain no duplicates and no path that is nested inside another root; if remove_nested_roots changes the list, the manifest is rejected. This guards against ambiguous or malicious manifests extracting into overlapping locations.
Solutions
- Delete the offending cache entry (manifest + artifact) so the task re-executes and writes a fresh manifest.
- Clear the whole task-artifacts cache directory if many entries are suspect.
- Do not hand-edit cache manifests; let mise generate them from the task's outputs config.
- If produced by custom remote-cache tooling, deduplicate/nest-filter roots before upload.
Example fix
// before (corrupt manifest.json)
{"roots": ["dist", "dist/subdir"], ...}
// after
rm <cache-dir>/<entry>/manifest.json && mise run build # task re-runs, writes {"roots": ["dist"]} Defensive patterns
Strategy: validation
Validate before calling
const roots = JSON.parse(fs.readFileSync(manifestPath, 'utf8')).roots;
const sorted = [...roots].sort();
if (new Set(sorted).size !== sorted.length) throw new Error('duplicate roots');
if (roots.some(r => roots.some(o => o !== r && (r.startsWith(o + '/'))))) throw new Error('nested roots'); Type guard
function hasCleanRoots(m: { roots: string[] }): boolean {
return m.roots.every((r, i) => m.roots.every((o, j) => i === j || !(r === o || r.startsWith(o + '/') || o.startsWith(r + '/'))));
} Try / catch
// treat manifest rejection as cache miss
try { restoreFromManifest(entry) } catch (e) {
if (String(e).includes('duplicate or nested roots')) { deleteEntry(entry); runTask(); }
else throw e;
} Prevention
- Never hand-edit cache manifest JSON files
- Ensure any custom cache-writing tooling deduplicates roots before upload
- Clear entries after interrupted cache writes
When it happens
Trigger: Restoring from a task cache entry (read_manifest + roots validation during cache hit resolution) when manifest.roots contains the same path twice or a path that is a strict descendant of another listed root — i.e. a hand-edited, corrupted, or wrongly generated manifest JSON.
Common situations: Manually editing or scripting cache manifests; a corrupted/partial manifest from an interrupted write; shared remote caches written by tooling that doesn't deduplicate roots.
Understand the failure class
Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.
Related errors
- task cache manifest does not match cache key
- ambiguous variants for
- dotfile enrollment metadata is too large
- dotfile enrollment metadata must be a regular file
- executor must be initialized before displaying cache stats
AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17).
Data as JSON: /api/errors/6c53c5d7f3900108.
Report an issue: GitHub.
Appendix: source
Thrown at src/task/task_cache.rs:566
if let Err(err) = self
.store
.remove_local(&self.key, self.action.len() as u64)
.await
{
warn!(
"failed to remove expired local task cache entry {}: {err}",
self.key
);
}
return Ok(TaskCacheRestore::Miss(TaskCacheMissReason::Expired));
}
let restore = || -> Result<TaskCacheHit> {
let manifest = self.read_manifest(&entry.manifest)?;
for root in &manifest.roots {
ensure_safe_relative(root)?;
}
if remove_nested_roots(manifest.roots.clone()) != manifest.roots {
bail!("task cache manifest contains duplicate or nested roots");
}
verify_artifact_checksum(
&manifest,
entry.artifact.as_ref().map(|artifact| artifact.path()),
)?;
if manifest.roots.is_empty() {
self.store.touch(&self.key);
return Ok(TaskCacheHit {
output: manifest.output,
restored_bytes: manifest.restored_bytes,
saved_duration: std::time::Duration::from_nanos(manifest.execution_duration_ns),
});
}
// Serialize restores targeting the same working directory across
// mise processes so validation and renames form one cooperative
// critical section. Result-only entries never mutate the task root.
let _output_lock = crate::lock_file::LockFile::new(
&self.root.join(".mise-task-artifact-cache-output"),View on GitHub (pinned to 533346cc37)