gitbutlerapp/gitbutler · error
line : merge requires exactly one commit
Error message
line {line_number}: merge requires exactly one commit What it means
The integration script parser requires a `merge` line to name exactly one commit argument. This error is raised when a `merge` line has zero arguments (just `merge`) or more than one (e.g. `merge a b`). Like the `pick` arity check, the message includes the line number for easy correction.
Solutions
- Edit the line so `merge` is followed by exactly one commit hash from the editable divergence (e.g. `merge 4444444`).
- Use `squash <hash1> <hash2> ...` if you intended to combine multiple commits, not merge.
- Remove the line if the merge step is no longer wanted.
Example fix
// before (script text) merge // after merge 4444444
Defensive patterns
Strategy: validation
Validate before calling
function validateMergeArity(line: string, lineNo: number): string | null {
const tokens = line.trim().split(/\s+/).filter(Boolean);
if (tokens[0] !== 'merge') return null;
if (tokens.length !== 2) return `line ${lineNo}: merge requires exactly one commit`;
return null;
} Type guard
const isMergeWithOneArg = (line: string): boolean =>
line.trim().split(/\s+/).filter(Boolean).length === 2 && line.trim().startsWith('merge '); Try / catch
try {
const steps = await parseIntegrationScript(script, divergence);
} catch (err) {
const m = /line (\d+): merge requires exactly one commit/.exec(String(err));
if (m) showEditorErrorAtLine(Number(m[1]), 'merge must reference exactly one commit');
else throw err;
} Prevention
- Keep exactly one hash after `merge`; delete the whole line to skip a step.
- Do not delete just the hash when editing — remove the entire line or replace the hash.
- Use `squash` when combining multiple commits is the goal.
When it happens
Trigger: Calling parse_integration_steps_script with a script containing `merge` with no hash, `merge <a> <b>`, or a `merge` line whose commit token is missing (e.g. deleted during editing).
Common situations: A user editing the rendered script deletes the hash but leaves the keyword, adds multiple hashes thinking merge accepts several, or an editor auto-complete leaves an incomplete line.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- line : pick requires exactly one commit
- line : squash requires at least two commits
- line : merge does not accept a message clause
- line : unknown command
- message must start with a double quote
AI-assisted analysis of gitbutlerapp/gitbutler@58e5313667 (2026-09-18).
Data as JSON: /api/errors/27295d3f5094db3d.
Report an issue: GitHub.
Appendix: 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 58e5313667)