jdx/mise · error

is not in either snapshot

Error message

{path} is not in either snapshot

What it means

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.

Solutions

  1. Check the exact tracked path (root-relative, e.g. `home/.zshrc`) with the snapshot listing, then retry.
  2. List the paths present in the chosen snapshots and pick one that exists in at least one of them.
  3. Verify the two snapshot ids actually span the period when the file was tracked.
  4. If the file should exist, capture a new snapshot first, then diff.

Example fix

// before
mise history diff snap1 snap2 --path /home/alice/.zshrc
// after (root-relative tracked path)
mise history diff snap1 snap2 --path home/.zshrc
Defensive patterns

Strategy: validation

Validate before calling

# shell: confirm the tracked path exists in a snapshot before diffing
mise history show <snapshot> --list | grep -F "home/.zshrc" || echo "path not tracked"

Try / catch

// Rust
match diff_path(a, b, path) {
    Ok(d) => show(d),
    Err(e) if e.to_string().contains("is not in either snapshot") => {
        eprintln!("check root-relative path spelling and snapshot range");
    }
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


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

Appendix: source

Thrown at src/system/history/shadow.rs:1127

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