{"record":{"id":"fb8375613b479222","repo":"jdx/mise","slug":"all-needs-to-ref","errorCode":null,"errorMessage":"`--all` needs `--to <ref>`","messagePattern":"`--all` needs `--to <ref>`","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/history/replay.rs","lineNumber":120,"sourceCode":"\n/// One checkpoint and the paths to take from it.\nstruct Target {\n    entry: Entry,\n    paths: Vec<PathBuf>,\n}\n\npub(crate) async fn rollback(req: RollbackRequest) -> Result<()> {\n    ensure_enabled()?;\n    if req.all && !req.paths.is_empty() {\n        bail!(\"choose explicit paths or `--all`, not both\");\n    }\n    if req.paths.is_empty() && !(req.to.is_some() && req.all) {\n        bail!(\n            \"name the paths to roll back, or `--to <ref> --all` for everything the checkpoint covers\"\n        );\n    }\n    if req.to.is_none() && req.all {\n        bail!(\"`--all` needs `--to <ref>`\");\n    }\n    let (store, tracked, entries) = crate::cli::dotfiles::history::open().await?;\n    let repo = store\n        .repo()\n        .ok_or_else(|| eyre::eyre!(\"rolling back requires git\"))?;\n    let live = live_tree(repo, &tracked)?;\n    let paths: Vec<PathBuf> = req\n        .paths\n        .iter()\n        .map(|path| normalize_target(path))\n        .collect();\n    for path in &paths {\n        if tracked.entry_for(path).is_none() {\n            bail!(\n                \"{} is not tracked; `mise bootstrap dotfiles paths` lists what is\",\n                display_path(path)\n            );\n        }","sourceCodeStart":102,"sourceCodeEnd":138,"githubUrl":"https://github.com/jdx/mise/blob/afd2eddd3a50c16190efc1c7e94404b48f72af57/src/system/history/replay.rs#L102-L138","documentation":"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.","triggerScenarios":"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.","commonSituations":"Users assume --all means \"all history\" or \"latest checkpoint\"; incremental edits to a command strip the --to argument while leaving --all in place.","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"],"exampleFix":"// before\nmise bootstrap dotfiles rollback --all\n// after\nmise bootstrap dotfiles rollback --to HEAD~1 --all","handlingStrategy":"validation","validationCode":"if (req.all && !req.to) {\n  throw new Error(\"--all requires --to <ref>\");\n}","typeGuard":"const allHasRef = (req: { all?: boolean; to?: string }) =>\n  req.all !== true || typeof req.to === \"string\";","tryCatchPattern":"try {\n  await rollback(req);\n} catch (e) {\n  if (String(e).includes(\"--all` needs\")) {\n    req.to = resolveLatestRef();\n    await rollback(req);\n  } else throw e;\n}","preventionTips":["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"],"tags":["cli","missing-flag"],"backgroundTag":"missing-required-flag","analyzedSha":"afd2eddd3a50c16190efc1c7e94404b48f72af57","analyzedAt":"2026-09-09T01:38:25.179Z","contentChangedAt":"2026-09-09T01:38:25.179Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}