gitbutlerapp/gitbutler · error

line : merge does not accept a message clause

Error message

line {line_number}: merge does not accept a message clause

What it means

`merge` steps in the integration script may not carry an inline message clause. The message clause is the optional `| message="..."` suffix (split on the `|` character by `split_message_clause`). This error is raised when a `merge` line contains such a suffix, because merges always use the commit's existing message.

Solutions

  1. Remove the `| message="..."` clause from the `merge` line; the merge uses the commit's original message.
  2. If a custom message is required for that content, convert the line to `squash <hash1> <hash2> | message="..."`, which is the only step kind that accepts a message.
  3. Verify there is no stray literal `|` character in the line (e.g. from shell-style formatting) that the parser interprets as a message clause.

Example fix

// before (script text)
merge 4444444 | message="my merge"
// after
merge 4444444
Defensive patterns

Strategy: validation

Validate before calling

function validateMergeLine(line: string, lineNo: number): string | null {
  const trimmed = line.trim();
  if (!trimmed.startsWith('merge')) return null;
  if (trimmed.includes('|')) return `line ${lineNo}: merge does not accept a message clause`;
  return null;
}

Type guard

const mergeHasNoMessageClause = (line: string): boolean =>
  !line.trim().startsWith('merge') || !line.includes('|');

Try / catch

try {
  const steps = await parseIntegrationScript(script, divergence);
} catch (err) {
  const m = /line (\d+): merge does not accept a message clause/.exec(String(err));
  if (m) showEditorErrorAtLine(Number(m[1]), 'remove the | message=... clause from merge lines');
  else throw err;
}

Prevention

When it happens

Trigger: Calling parse_integration_steps_script with a script line like `merge 4444444 | message="custom"`. The `|` character anywhere after the command tokens on a `merge` line triggers it.

Common situations: A user copies the `squash ... | message="..."` syntax and applies it to a `merge` line, assuming all steps support inline rewording, or an editor/tooling appends a suffix that includes a literal pipe character.

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/5b08d5c8ff45ee98. Report an issue: GitHub.

Appendix: source

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

                if message_part.is_some() {
                    bail!("line {line_number}: pick does not accept a message clause");
                }
                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");
                }

View on GitHub (pinned to 58e5313667)