jdx/mise · error
`--all` needs `--to <ref>`
Error message
`--all` needs `--to <ref>`
What it means
The --all flag is only meaningful together with --to <ref>: it means "restore everything the checkpoint at <ref> covers". Requesting --all without --to leaves no reference to restore from, so mise rejects it. This check runs after the paths/`--all` mutual-exclusion check in rollback.
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 bootstrap dotfiles paths` lists what is",
display_path(path)
);
}View on GitHub (pinned to afd2eddd3a)
Solutions
- Add a ref: `mise bootstrap dotfiles rollback --to <ref> --all`
- Find a ref via `mise bootstrap dotfiles history`
- If you only want certain files, name them explicitly instead of using --all
Example fix
// before mise bootstrap dotfiles rollback --all // after mise bootstrap dotfiles rollback --to HEAD~1 --all
Defensive patterns
Strategy: validation
Validate before calling
if (req.all && !req.to) {
throw new Error("--all requires --to <ref>");
} Type guard
const allHasRef = (req: { all?: boolean; to?: string }) =>
req.all !== true || typeof req.to === "string"; Try / catch
try {
await rollback(req);
} catch (e) {
if (String(e).includes("--all` needs")) {
req.to = resolveLatestRef();
await rollback(req);
} else throw e;
} Prevention
- Encode --all as requiring --to in clap (requires = "to")
- Resolve --all to an explicit ref before calling rollback programmatically
- Add an integration test for --all without --to
When it happens
Trigger: Calling `rollback --all` without `--to <ref>` (req.to.is_none() && req.all). Typically after fixing the not-both error by dropping paths but keeping --all.
Common situations: Users assume --all means "all history" or "latest checkpoint"; incremental edits to a command strip the --to argument while leaving --all in place.
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
- not connected: choose --sync manual, --sync sync, or --sync
- {}@{requested} is not installed{resolved} hint: run `mise in
- No executable found for configured tool: {bin_name} The inst
- {bin_name} is a mise bin however it is not currently active.
- bootstrap command is registered
AI-assisted analysis of jdx/mise@afd2eddd3a (2026-09-09).
Data as JSON: /api/errors/fb8375613b479222.
Report an issue: GitHub.