jdx/mise · error
{path} is not in either snapshot
Error message
{path} is not in either snapshot What it means
When diffing two snapshots, the code resolves each requested path in the 'from' and 'to' trees. If the path is found in neither snapshot, no comparison is possible and the diff bails with a message naming both path forms.
Source
Thrown at src/system/history/shadow.rs:874
|| !super::sync::files::encrypted_paths(self, Some(b))?.is_empty()
{
return self.decrypted_diff(a, b, opts);
}
let (from, to) = match &opts.paths {
Some((from_path, to_path)) => {
let from = format!("{a}:{from_path}");
let to = format!("{b}:{to_path}");
match (self.object_type(&from)?, self.object_type(&to)?) {
(Some(_), Some(_)) => (from, to),
(Some(kind), None) => (from, self.empty_object(&kind)?),
(None, Some(kind)) => (self.empty_object(&kind)?, to),
(None, None) => {
let path = if from_path == to_path {
from_path.clone()
} else {
format!("{from_path} / {to_path}")
};
bail!("{path} is not in either snapshot");
}
}
}
None => (a.to_string(), b.to_string()),
};
let call = PlumbingCall::new([
"diff",
"--no-ext-diff",
"--exit-code",
if opts.patch { "--patch" } else { "--stat" },
if opts.color {
"--color=always"
} else {
"--color=never"
},
&from,
&to,
]);View on GitHub (pinned to afd2eddd3a)
Solutions
- List the snapshot contents to find the correct path spelling, then retry with the exact path
- Omit the path filter to diff the whole snapshot
- Verify you are comparing the intended pair of checkpoints/refs that actually contain the file
Example fix
// before history diff a b --path ".config/nvim/init.vim" // after (actual tracked path) history diff a b --path "home/.config/nvim/init.vim"
Defensive patterns
Strategy: try-catch
Validate before calling
// Rust: confirm the path exists in at least one snapshot before diffing
let in_from = from_tree.entry_for(path).is_some();
let in_to = to_tree.entry_for(path).is_some();
anyhow::ensure!(in_from || in_to, "path {path} absent from both snapshots"); Try / catch
match differ.diff(from, to, Some(path)) {
Err(e) if e.to_string().contains("is not in either snapshot") => {
eprintln!("path not tracked in these snapshots; listing available paths...");
}
other => other?,
} Prevention
- Copy paths from snapshot listings rather than typing them
- Remember paths are snapshot-root-relative (home/..., config/..., fs/...)
- Diff without a path filter first to discover valid paths
When it happens
Trigger: Calling diff with a path filter that matches no entry in either the from-snapshot or the to-snapshot.
Common situations: Typo in the path argument; the file was untracked in both snapshots; using a path relative to the wrong root or an absolute path where a snapshot-relative path is expected.
Understand the failure class
Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.
Related errors
- path is not in either snapshot
- remote task path is not a regular file or directory: {}
- {other:?}
- {raw}: target must be absolute or start with ~/
- {target_raw}: target must be absolute or start with ~/
AI-assisted analysis of jdx/mise@afd2eddd3a (2026-09-09).
Data as JSON: /api/errors/36dc85709134a6fe.
Report an issue: GitHub.