jdx/mise · error

--operation takes at most one checkpoint reference

Error message

--operation takes at most one checkpoint reference

What it means

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.

Solutions

  1. Drop the second reference: `mise dotfiles history diff --operation <ref>`
  2. Compare two checkpoints with plain refs and no --operation: `mise dotfiles history diff <refA> <refB>`

Example fix

// before
mise dotfiles history diff --operation abc def
// after
mise dotfiles history diff --operation abc
# or
mise dotfiles history diff abc def
Defensive patterns

Strategy: validation

Validate before calling

[ $# -le 1 ] || echo '--operation takes at most one checkpoint reference'

Try / catch

match Err(msg) if msg.contains("--operation takes at most one") => drop the second ref and re-run

Prevention

When it happens

Trigger: `mise dotfiles history diff --operation <refA> <refB>` — the --operation flag is set and self.b is Some.

Common situations: Users copying the plain two-ref diff syntax and adding --operation; scripts combining flags without reading the help.

Understand the failure class

Background: "mutually exclusive" flag errors: what "can't supply both nx and xx", "--raw is not compatible with -i" and "cannot be used with" mean, and how to fix them — this error's family across 29 libraries.

Related errors


AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17). Data as JSON: /api/errors/7a3668597e5fade7. Report an issue: GitHub.

Appendix: source

Thrown at src/cli/dotfiles/history/diff.rs:54

    #[usage(long, value_name = "PATH")]
    path: Option<String>,

    /// Exit 1 when the two sides differ
    #[usage(long)]
    exit_code: bool,
}

impl HistoryDiff {
    pub(crate) async fn run(self) -> Result<()> {
        let (store, tracked, entries) = super::open().await?;
        let Some(repo) = store.repo() else {
            bail!("comparing checkpoints requires git");
        };
        let path = self.path.as_deref().map(display_arg);
        let (from, to, label) =
            if self.operation {
                if self.b.is_some() {
                    bail!("--operation takes at most one checkpoint reference");
                }
                let outcome = match &self.a {
                    Some(reference) => super::resolve(reference, &entries, None)?,
                    None => entries
                        .iter()
                        .rev()
                        .find(|entry| entry.checkpoint.operation.is_some())
                        .cloned()
                        .ok_or_else(|| eyre::eyre!("no recorded operation"))?,
                };
                let operation =
                    outcome.checkpoint.operation.as_ref().ok_or_else(|| {
                        eyre::eyre!("checkpoint {} is not an operation", outcome.id)
                    })?;
                let before = operation
                    .before
                    .as_ref()
                    .and_then(|uuid| entries.iter().find(|entry| &entry.checkpoint.uuid == uuid))

View on GitHub (pinned to 533346cc37)