jdx/mise · error

choose explicit paths or `--all`, not both

Error message

choose explicit paths or `--all`, not both

What it means

The history rollback request accepts either explicit paths or the `--all` flag, but not both: `--all` means 'everything the checkpoint covers', which is contradictory with an explicit path list. rollback rejects the request up front with this message before doing any work.

Solutions

  1. Drop `--all` when you want to roll back specific paths: `rollback path1 path2`
  2. Drop the path list when you want everything: `rollback --to <ref> --all`
  3. Fix the calling script/alias so it emits either paths or `--all`, never both

Example fix

// before
rollback(RollbackRequest { all: true, paths: vec!["/a".into()], .. })
// after
rollback(RollbackRequest { all: false, paths: vec!["/a".into()], .. })
// or: rollback(RollbackRequest { all: true, paths: vec![], to: Some(ref), .. })
Defensive patterns

Strategy: validation

Validate before calling

fn valid_rollback_req(req: &RollbackRequest) -> bool {
    !(req.all && !req.paths.is_empty())
        && (!req.paths.is_empty() || (req.to.is_some() && req.all))
}

Prevention

When it happens

Trigger: Calling rollback with a RollbackRequest where all == true AND paths is non-empty — e.g. `mise history rollback --all path1 path2` or programmatically setting both fields.

Common situations: Users adding `--all` for safety while also listing paths out of habit; scripts templating flags and appending a path list; shell aliases that hard-code `--all`.

Understand the failure class

Background: "mutually exclusive" flag errors: what "can't supply both nx and xx", "--raw is not compatible with -i" and "cannot be used with" mean, and how to fix them — this error's family across 29 libraries.

Related errors


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

Appendix: source

Thrown at src/system/history/replay.rs:112

    from: String,
    to: String,
    /// The permission bits the checkpoint recorded for the file (only
    /// modes git cannot express, `0600` say), and for the directories
    /// above it.
    bits: Option<u32>,
    dir_bits: Vec<(PathBuf, u32)>,
}

/// One checkpoint and the paths to take from it.
struct Target {
    entry: Entry,
    paths: Vec<PathBuf>,
}

pub(crate) async fn rollback(req: RollbackRequest) -> Result<()> {
    ensure_enabled()?;
    if req.all && !req.paths.is_empty() {
        bail!("choose explicit paths or `--all`, not both");
    }
    if req.paths.is_empty() && !(req.to.is_some() && req.all) {
        bail!(
            "name the paths to roll back, or `--to <ref> --all` for everything the checkpoint covers"
        );
    }
    if req.to.is_none() && req.all {
        bail!("`--all` needs `--to <ref>`");
    }
    let (store, tracked, entries) = crate::cli::dotfiles::history::open().await?;
    let repo = store
        .repo()
        .ok_or_else(|| eyre::eyre!("rolling back requires git"))?;
    let live = live_tree(repo, &tracked)?;
    let paths: Vec<PathBuf> = req
        .paths
        .iter()
        .map(|path| normalize_target(path))

View on GitHub (pinned to 533346cc37)