gitbutlerapp/gitbutler · error

Need to specify a rev-spec of form `a..b` to indicate an…

Error message

Need to specify a rev-spec of form `a..b` to indicate an exclusion for now.

What it means

When the log command has an `included` commit but no `excluded` one, it can still walk reachable commits; but the current code path requires that an exclusion was provided, otherwise it bails asking for an `a..b` rev-spec. This is a stated temporary limitation of the graph walk API used (find_commit_ids_reachable_from_a_not_b).

Solutions

  1. Pass a rev-spec of the form `a..b` (e.g. `main..feature`) so the exclusion side exists
  2. If you want all commits reachable from b without exclusion, wait for/update to a version where single-rev logs are supported, or use the gix graph API directly
  3. Adjust scripts to always supply the base commit of the range

Example fix

// before
but debug log --rev-spec "feature"
// after
but debug log --rev-spec "main..feature"
Defensive patterns

Strategy: validation

Validate before calling

if !rev_spec.contains("..") {
    anyhow::bail!("supply an exclusion: use `a..b` form");
}

Try / catch

match api.log(&repo, args, &mut out) {
    Err(e) if e.to_string().contains("Need to specify a rev-spec of form `a..b`") => {
        eprintln!("add a base: e.g. main..feature");
    }
    other => other?,
}

Prevention

When it happens

Trigger: Calling log (from run) with a graph argument whose rev-spec resolves to Spec::Include only (no `a..b` range), so `excluded` is None and the else branch bails.

Common situations: Users passing a single revision like `main` when they intended `base..main`; scripts omitting the exclusion side of the range; older invocations written before the range requirement was added.

Understand the failure class

Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.

Related errors


AI-assisted analysis of gitbutlerapp/gitbutler@58e5313667 (2026-09-18). Data as JSON: /api/errors/3148161155760b9b. Report an issue: GitHub.

Appendix: source

Thrown at crates/but-debug/src/command/revision.rs:68

    let mut graph_commits = vec![included];
    graph_commits.extend(excluded);

    let graph_tips = args_to_tips(repo, &log_args.graph)?;
    let graph = {
        let _span =
            tracing::info_span!("build graph", commit_count = graph_commits.len()).entered();
        graph_for_revisions(repo, meta, &graph_commits, graph_tips)?
    };

    let _span = tracing::info_span!("traverse graph").entered();
    let commits = if let Some(excluded) = excluded {
        graph.find_commit_ids_reachable_from_a_not_b(
            included,
            excluded,
            FirstParent::from(log_args.first_parent),
        )?
    } else {
        bail!("Need to specify a rev-spec of form `a..b` to indicate an exclusion for now.")
    };

    let mut out = io::BufWriter::new(out);
    for commit_id in commits {
        commit_id.write_hex_to(&mut out)?;
        writeln!(out)?;
    }
    Ok(())
}

fn merge_base(
    repo: &gix::Repository,
    meta: &EmptyRefMetadata,
    merge_base_args: &MergeBaseArgs,
    out: &mut dyn io::Write,
) -> Result<()> {
    let commits = {
        let _span = tracing::info_span!(

View on GitHub (pinned to 58e5313667)