{"record":{"id":"7a3668597e5fade7","repo":"jdx/mise","slug":"operation-takes-at-most-one-checkpoint-reference","errorCode":null,"errorMessage":"--operation takes at most one checkpoint reference","messagePattern":"--operation takes at most one checkpoint reference","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cli/dotfiles/history/diff.rs","lineNumber":54,"sourceCode":"    #[usage(long, value_name = \"PATH\")]\n    path: Option<String>,\n\n    /// Exit 1 when the two sides differ\n    #[usage(long)]\n    exit_code: bool,\n}\n\nimpl HistoryDiff {\n    pub(crate) async fn run(self) -> Result<()> {\n        let (store, tracked, entries) = super::open().await?;\n        let Some(repo) = store.repo() else {\n            bail!(\"comparing checkpoints requires git\");\n        };\n        let path = self.path.as_deref().map(display_arg);\n        let (from, to, label) =\n            if self.operation {\n                if self.b.is_some() {\n                    bail!(\"--operation takes at most one checkpoint reference\");\n                }\n                let outcome = match &self.a {\n                    Some(reference) => super::resolve(reference, &entries, None)?,\n                    None => entries\n                        .iter()\n                        .rev()\n                        .find(|entry| entry.checkpoint.operation.is_some())\n                        .cloned()\n                        .ok_or_else(|| eyre::eyre!(\"no recorded operation\"))?,\n                };\n                let operation =\n                    outcome.checkpoint.operation.as_ref().ok_or_else(|| {\n                        eyre::eyre!(\"checkpoint {} is not an operation\", outcome.id)\n                    })?;\n                let before = operation\n                    .before\n                    .as_ref()\n                    .and_then(|uuid| entries.iter().find(|entry| &entry.checkpoint.uuid == uuid))","sourceCodeStart":36,"sourceCodeEnd":72,"githubUrl":"https://github.com/jdx/mise/blob/afd2eddd3a50c16190efc1c7e94404b48f72af57/src/cli/dotfiles/history/diff.rs#L36-L72","documentation":"In `dotfiles history diff`, `--operation` mode compares two checkpoints derived from history operations and therefore accepts at most one explicit checkpoint reference (the second endpoint defaults to the latest matching entry). Passing two references (`a` and `b`) together with `--operation` is unsupported and throws this error.","triggerScenarios":"Running `mise bootstrap dotfiles history diff --operation refA refB` — i.e. `--operation` combined with two positional checkpoint references (self.b is Some).","commonSituations":"Copying the two-reference syntax of normal checkpoint diffing and adding `--operation` to it; scripts that always pass two refs.","solutions":["Drop `--operation` when comparing two explicit checkpoint references.","Keep `--operation` and pass at most one reference; the second endpoint is resolved automatically.","Resolve the operation checkpoints first with `mise bootstrap dotfiles history ls` and diff them by plain checkpoint refs instead."],"exampleFix":"// before\nmise bootstrap dotfiles history diff --operation op1 op2\n// after\nmise bootstrap dotfiles history diff --operation op1\n# or two plain refs without --operation\nmise bootstrap dotfiles history diff op1 op2","handlingStrategy":"validation","validationCode":"# pass at most one ref when using --operation\nrefs=$#\nif [ \"$use_operation\" = 1 ] && [ \"$refs\" -gt 1 ]; then\n  echo \"--operation takes at most one checkpoint reference\"; exit 1\nfi","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Remember: `--operation` mode auto-resolves the second endpoint.","Only pass two refs for plain checkpoint diffs without `--operation`."],"tags":["dotfiles","cli","flags"],"backgroundTag":"mutually-exclusive-flags","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"}