jdx/mise · error

path is not in either snapshot

Error message

path is not in either snapshot

What it means

In the path-filtered diff flow, when the user supplied explicit paths (`opts.paths`) but the diff computation found no matching entries in either snapshot, this bail fires. Unlike error 945 it carries no path names, because filtering happened across a set of candidate paths that all came up empty.

Solutions

  1. Verify each path against the snapshot listing and use root-relative tracked paths (e.g. `home/.gitconfig`).
  2. Diff without path filters first to see which paths exist in the two snapshots.
  3. Pick snapshots that actually contain the files (check timestamps of checkpoints).
  4. Fix glob/path syntax if using patterns — overly narrow globs can match nothing.

Example fix

// before
mise history diff a b --path /Users/alice/.config/mise/config.toml
// after
mise history diff a b --path config/mise/config.toml
Defensive patterns

Strategy: validation

Validate before calling

# ensure at least one filtered path is tracked before diffing
for p in "home/.zshrc" "config/mise/config.toml"; do
  mise history show <snapshot> --list | grep -F "$p" && break
done

Try / catch

// Rust
match diff_paths(a, b, &paths) {
    Ok(d) => show(d),
    Err(e) if e.to_string().contains("path is not in either snapshot") => {
        eprintln!("none of the given paths are tracked in these snapshots");
    }
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: A history diff invoked with one or more `--path` filters where none of the given paths match any file in either snapshot (all candidate sets empty), at shadow.rs:1202 in the paths-collection loop.

Common situations: All supplied paths misspelled or formatted wrong (absolute OS paths vs root-relative tracked paths), paths that were never tracked, or both snapshots predate the files entirely.

Understand the failure class

Background: EmptyResultError / "no results found": when an API or scraper succeeds but returns zero rows — this error's family across 9 libraries.

Related errors


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

Appendix: source

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

            (b, opts.paths.as_ref().map(|p| p.1.as_str())),
        ] {
            for entry in self.ls_tree(tree)? {
                if entry.path.starts_with(".mise-history/") {
                    continue;
                }
                if let Some(prefix) = prefix {
                    if entry.path == prefix {
                        paths.insert(String::new());
                    } else if let Some(relative) = entry.path.strip_prefix(&format!("{prefix}/")) {
                        paths.insert(relative.to_string());
                    }
                } else {
                    paths.insert(entry.path);
                }
            }
        }
        if paths.is_empty() && opts.paths.is_some() {
            bail!("path is not in either snapshot");
        }
        let mut output = vec![];
        let mut changed = false;
        for relative in paths {
            let path = |prefix: &str| {
                if relative.is_empty() {
                    prefix.to_string()
                } else {
                    format!("{prefix}/{relative}")
                }
            };
            let (left_path, right_path) = opts.paths.as_ref().map_or_else(
                || (relative.clone(), relative.clone()),
                |(left, right)| (path(left), path(right)),
            );
            let left = self.restored_object_at(a, &left_path)?;
            let right = self.restored_object_at(b, &right_path)?;
            if left == right {

View on GitHub (pinned to 533346cc37)