gitbutlerapp/gitbutler · error · anyhow::Error

line {line_number}: merge requires exactly one commit

Error message

line {line_number}: merge requires exactly one commit

What it means

Raised by `parse_integration_steps_script` when a `merge` line does not have exactly one argument after whitespace tokenization. Merge is strictly `merge <commit-spec>`.

Source

Thrown at crates/but-workspace/src/branch/integrate_branch_upstream/parsing.rs:65

                if arguments.len() != 1 {
                    bail!("line {line_number}: pick requires exactly one commit");
                }
                let commit = arguments
                    .first()
                    .copied()
                    .expect("validated pick arity above");
                InteractiveIntegrationStep::Pick {
                    commit_id: resolve_commit(commit, &allowed_commits).map_err(|err| {
                        anyhow::anyhow!("line {line_number}: invalid pick commit: {err}")
                    })?,
                }
            }
            "merge" => {
                if message_part.is_some() {
                    bail!("line {line_number}: merge does not accept a message clause");
                }
                if arguments.len() != 1 {
                    bail!("line {line_number}: merge requires exactly one commit");
                }
                let commit = arguments
                    .first()
                    .copied()
                    .expect("validated merge arity above");
                InteractiveIntegrationStep::Merge {
                    commit_id: resolve_commit(commit, &allowed_commits).map_err(|err| {
                        anyhow::anyhow!("line {line_number}: invalid merge commit: {err}")
                    })?,
                }
            }
            "squash" => {
                if arguments.len() < 2 {
                    bail!("line {line_number}: squash requires at least two commits");
                }
                let commits = arguments
                    .iter()
                    .map(|commit| {

View on GitHub (pinned to caf1f223d3)

Solutions

  1. Use exactly one commit spec: `merge 7d1e00f`.
  2. Strip commit subjects when pasting from `git rebase -i` todos.

Example fix

# before
merge 7d1e00f merge branch 'origin/main'

# after
merge 7d1e00f
Defensive patterns

Strategy: validation

Try / catch

if let Err(err) = parse_integration_steps_script(&script, &divergence) {
    // 'line {n}: merge requires exactly one commit' -> point user at that line
}

Prevention

When it happens

Trigger: Lines like `merge` alone, `merge 7d1e 4f2a`, or `merge 7d1e00f extra words` (e.g. a pasted commit subject).

Common situations: Copying git-rebase todo lines that include subjects after the SHA; typos that split or duplicate the spec.

Related errors


AI-assisted analysis of gitbutlerapp/gitbutler@caf1f223d3 (2026-08-20). Data as JSON: /api/errors/27295d3f5094db3d. Report an issue: GitHub.