{"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":"console","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/533346cc374382b41ec5ff70536252b2e96e725c/src/cli/dotfiles/history/diff.rs#L36-L72","documentation":"With `--operation`, diff compares an operation-based checkpoint reference against at most one other reference. Passing two explicit references (a and b) together with --operation is rejected because the operation already implies one side.","triggerScenarios":"`mise dotfiles history diff --operation <refA> <refB>` — the --operation flag is set and self.b is Some.","commonSituations":"Users copying the plain two-ref diff syntax and adding --operation; scripts combining flags without reading the help.","solutions":["Drop the second reference: `mise dotfiles history diff --operation <ref>`","Compare two checkpoints with plain refs and no --operation: `mise dotfiles history diff <refA> <refB>`"],"exampleFix":"// before\nmise dotfiles history diff --operation abc def\n// after\nmise dotfiles history diff --operation abc\n# or\nmise dotfiles history diff abc def","handlingStrategy":"validation","validationCode":"[ $# -le 1 ] || echo '--operation takes at most one checkpoint reference'","typeGuard":null,"tryCatchPattern":"match Err(msg) if msg.contains(\"--operation takes at most one\") => drop the second ref and re-run","preventionTips":["Read `--help` before combining diff flags","Use --operation with a single reference","Use plain two-ref diff syntax without --operation for A..B comparisons"],"tags":["cli","dotfiles","flags"],"backgroundTag":"mutually-exclusive-flags","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"}