jdx/mise · error

`--all` needs `--to

Error message

`--all` needs `--to <ref>`

What it means

The `--all` flag on `mise dot rollback` means 'restore everything covered by the checkpoint identified by `--to <ref>`', so `--all` without `--to` is meaningless and rejected. The code refuses to guess which checkpoint to roll back to.

Solutions

  1. Add `--to <ref>` naming the checkpoint: `mise dot rollback --to <ref> --all`
  2. Find available checkpoint refs with `mise dot history`
  3. If you only want specific files restored, drop `--all` and list the paths instead

Example fix

// before
mise dot rollback --all
// after
mise dot rollback --to checkpoint-42 --all
Defensive patterns

Strategy: validation

Validate before calling

if (req.all && !req.to) {
  throw new Error('--all requires --to <ref>');
}

Prevention

When it happens

Trigger: Calling rollback with `all: true` and `to: None` (and paths empty or not) — e.g. `mise dot rollback --all`.

Common situations: Users treat `--all` like a standalone 'roll everything back' switch, forgetting that a target checkpoint ref must also be named.

Understand the failure class

Background: "--flag is required" and "must specify" CLI errors: how missing-required-flag validation works and how to fix it — this error's family across 20 libraries.

Related errors


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

Appendix: source

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

/// 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))
        .collect();
    for path in &paths {
        if tracked.entry_for(path).is_none() {
            bail!(
                "{} is not tracked; `mise dot paths` lists what is",
                display_path(path)
            );
        }

View on GitHub (pinned to 533346cc37)