gitbutlerapp/gitbutler · error

Unsupported rev-spec for revision log

Error message

Unsupported rev-spec for revision log: {other}

What it means

The revision log parser accepts only rev-specs that resolve to Spec::Include(commit_id) or Spec::Range{from,to}. Any other parsed Spec variant cannot be expressed as an (included, excluded) pair for the graph walk, so `log` bails naming the unsupported variant.

Solutions

  1. Use a single commit id/rev (Include) or a range `a..b` (Range) as the rev-spec
  2. Avoid exclusion-only specs like `^main`; express the intent as a range instead
  3. Check the parsed Spec variant you get for your input and add support for it if a new form is genuinely needed

Example fix

// before
--rev-spec "^main"            // unsupported variant
// after
--rev-spec "feature..main"    // Range{from: feature, to: main}
Defensive patterns

Strategy: validation

Validate before calling

if !(rev_spec.contains("..") || !rev_spec.starts_with('^')) {
    anyhow::bail!("rev-spec must be a single rev or an a..b range");
}

Try / catch

match api.log(&repo, args, &mut out) {
    Err(e) if e.to_string().contains("Unsupported rev-spec") => eprintln!("use a single rev or an `a..b` range"),
    other => other?,
}

Prevention

When it happens

Trigger: Calling log (from run) with log_args.rev_spec that parses to a Spec variant other than Include or Range — e.g. an exclusion-only spec like `^main`, or other gix spec forms.

Common situations: Users passing `^branch` or `--not`-style specs, multiple revs, or ref globs to the debug revision-log command; scripts copying git log syntax that gix's spec parser models differently.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


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

Appendix: source

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

        }
    }
}

fn log(
    repo: &gix::Repository,
    meta: &EmptyRefMetadata,
    log_args: &LogArgs,
    out: &mut dyn io::Write,
) -> Result<()> {
    let parsed = repo
        .rev_parse(log_args.rev_spec.as_str())
        .with_context(|| format!("Failed to parse rev-spec '{}'", log_args.rev_spec))?
        .detach();

    let (included, excluded) = match parsed {
        Spec::Include(commit_id) => (commit_id, None),
        Spec::Range { from, to } => (to, Some(from)),
        other => bail!("Unsupported rev-spec for revision log: {other}"),
    };
    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),
        )?

View on GitHub (pinned to 58e5313667)