{"record":{"id":"36dc85709134a6fe","repo":"jdx/mise","slug":"path-is-not-in-either-snapshot","errorCode":null,"errorMessage":"{path} is not in either snapshot","messagePattern":"(.+?) is not in either snapshot","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/history/shadow.rs","lineNumber":1127,"sourceCode":"            || !super::sync::files::encrypted_paths(self, Some(b))?.is_empty()\n        {\n            return self.decrypted_diff(a, b, opts);\n        }\n        let (from, to) = match &opts.paths {\n            Some((from_path, to_path)) => {\n                let from = format!(\"{a}:{from_path}\");\n                let to = format!(\"{b}:{to_path}\");\n                match (self.object_type(&from)?, self.object_type(&to)?) {\n                    (Some(_), Some(_)) => (from, to),\n                    (Some(kind), None) => (from, self.empty_object(&kind)?),\n                    (None, Some(kind)) => (self.empty_object(&kind)?, to),\n                    (None, None) => {\n                        let path = if from_path == to_path {\n                            from_path.clone()\n                        } else {\n                            format!(\"{from_path} / {to_path}\")\n                        };\n                        bail!(\"{path} is not in either snapshot\");\n                    }\n                }\n            }\n            None => (a.to_string(), b.to_string()),\n        };\n        let call = PlumbingCall::new([\n            \"diff\",\n            \"--no-ext-diff\",\n            \"--exit-code\",\n            if opts.patch { \"--patch\" } else { \"--stat\" },\n            if opts.color {\n                \"--color=always\"\n            } else {\n                \"--color=never\"\n            },\n            &from,\n            &to,\n        ]);","sourceCodeStart":1109,"sourceCodeEnd":1145,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/system/history/shadow.rs#L1109-L1145","documentation":"When building a diff between two snapshots, the code resolves the requested path in both the 'from' and 'to' trees. If the path is absent from both snapshots, it cannot produce a diff and bails with a message naming the path(s). This guards against diffing a path that simply does not exist in either revision.","triggerScenarios":"Requesting a path-limited history diff where the given path (after prefix mapping) matches no entry in either snapshot tree — e.g. `mise history diff <a> <b> --path some/file` for a file that was never tracked in either revision.","commonSituations":"Typos in the path argument, using an OS-absolute path instead of the root-relative tracked path (e.g. \"home/.zshrc\" vs \"/home/user/.zshrc\"), or diffing snapshots from before the file was first tracked.","solutions":["Check the exact tracked path (root-relative, e.g. `home/.zshrc`) with the snapshot listing, then retry.","List the paths present in the chosen snapshots and pick one that exists in at least one of them.","Verify the two snapshot ids actually span the period when the file was tracked.","If the file should exist, capture a new snapshot first, then diff."],"exampleFix":"// before\nmise history diff snap1 snap2 --path /home/alice/.zshrc\n// after (root-relative tracked path)\nmise history diff snap1 snap2 --path home/.zshrc","handlingStrategy":"validation","validationCode":"# shell: confirm the tracked path exists in a snapshot before diffing\nmise history show <snapshot> --list | grep -F \"home/.zshrc\" || echo \"path not tracked\"","typeGuard":null,"tryCatchPattern":"// Rust\nmatch diff_path(a, b, path) {\n    Ok(d) => show(d),\n    Err(e) if e.to_string().contains(\"is not in either snapshot\") => {\n        eprintln!(\"check root-relative path spelling and snapshot range\");\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Always use root-relative tracked paths (home/..., config/..., fs/...), not OS absolute paths.","List snapshot contents before path-filtered diffs.","Choose snapshots from the period when the file was tracked."],"tags":["git","diff","history"],"backgroundTag":"path-not-in-snapshot","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"}