{"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 dot paths` lists what is\",\n                display_path(path)\n            );\n        }","sourceCodeStart":102,"sourceCodeEnd":138,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/system/history/replay.rs#L102-L138","documentation":"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.","triggerScenarios":"Calling rollback with `all: true` and `to: None` (and paths empty or not) — e.g. `mise dot rollback --all`.","commonSituations":"Users treat `--all` like a standalone 'roll everything back' switch, forgetting that a target checkpoint ref must also be named.","solutions":["Add `--to <ref>` naming the checkpoint: `mise dot rollback --to <ref> --all`","Find available checkpoint refs with `mise dot history`","If you only want specific files restored, drop `--all` and list the paths instead"],"exampleFix":"// before\nmise dot rollback --all\n// after\nmise dot rollback --to checkpoint-42 --all","handlingStrategy":"validation","validationCode":"if (req.all && !req.to) {\n  throw new Error('--all requires --to <ref>');\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Treat --all as a modifier of --to, never standalone","Look up the checkpoint ref from `mise dot history` first","Add a lint/CI check for CLI wrappers that pass --all without --to"],"tags":["cli","dotfiles","validation"],"backgroundTag":"missing-required-flag","analyzedSha":"533346cc374382b41ec5ff70536252b2e96e725c","analyzedAt":"2026-09-17T13:35:38.149Z","contentChangedAt":"2026-09-17T13:35:38.149Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}