{"record":{"id":"7be037b15b76a2bc","repo":"jdx/mise","slug":"name-the-paths-to-roll-back-or-to-ref-all","errorCode":null,"errorMessage":"name the paths to roll back, or `--to <ref> --all` for everything the checkpoint covers","messagePattern":"name the paths to roll back, or `--to <ref> --all` for everything the checkpoint covers","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/history/replay.rs","lineNumber":115,"sourceCode":"    /// modes git cannot express, `0600` say), and for the directories\n    /// above it.\n    bits: Option<u32>,\n    dir_bits: Vec<(PathBuf, u32)>,\n}\n\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() {","sourceCodeStart":97,"sourceCodeEnd":133,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/system/history/replay.rs#L97-L133","documentation":"`mise dot rollback` requires you to say what to restore: either explicit file paths, or both `--to <ref>` and `--all` to restore everything the checkpoint covers. The command throws this when neither form is supplied (no paths, and not the full `--to` + `--all` combination), because it would otherwise have no idea what to act on.","triggerScenarios":"Calling rollback (CLI `mise dot rollback` or RollbackRequest via API) with `paths` empty and either `to` unset or `all` unset — e.g. `mise dot rollback` with no flags, or `mise dot rollback --to abc123` without `--all`.","commonSituations":"Users run `mise dot rollback` expecting it to restore the last checkpoint automatically; they pass `--to <ref>` but forget `--all`; scripts build a RollbackRequest but fail to populate `paths`.","solutions":["Pass the paths to restore: `mise dot rollback path1 path2` (use `mise dot paths` to list tracked paths)","Pass both flags to restore everything: `mise dot rollback --to <ref> --all`","If you intended only `--all`-style rollback, first find the checkpoint ref from `mise dot history` and add `--to <ref>`"],"exampleFix":"// before\nmise dot rollback --to checkpoint-42\n// after\nmise dot rollback --to checkpoint-42 --all","handlingStrategy":"validation","validationCode":"if (req.paths.length === 0 && !(req.to && req.all)) {\n  throw new Error('provide paths, or --to <ref> --all');\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pair --all with --to <ref> in scripts","Resolve paths via `mise dot paths` before building a RollbackRequest","Validate that either paths or (to && all) is set in any wrapper around rollback"],"tags":["cli","dotfiles","validation"],"backgroundTag":"missing-required-argument","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"}