gitbutlerapp/gitbutler · error · anyhow::Error
line {line_number}: squash requires at least two commits
Error message
line {line_number}: squash requires at least two commits What it means
Raised by `parse_integration_steps_script` when a `squash` line lists fewer than two commit specs. Squash exists solely to combine multiple commits, so a single-commit squash is rejected at parse time.
Source
Thrown at crates/but-workspace/src/branch/integrate_branch_upstream/parsing.rs:79
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| {
resolve_commit(commit, &allowed_commits).map_err(|err| {
anyhow::anyhow!(
"line {line_number}: invalid squash commit '{commit}': {err}"
)
})
})
.collect::<Result<Vec<_>>>()?;
InteractiveIntegrationStep::Squash {
commits,
message: message_part
.map(parse_message_clause)
.transpose()
.map_err(|err| {
anyhow::anyhow!("line {line_number}: invalid squash message: {err}")View on GitHub (pinned to caf1f223d3)
Solutions
- Keep at least two commits on the line: `squash 4f2a9c1 991b3aa`.
- If only one commit should remain, replace the squash line with `pick <sha>`.
- If the group should vanish entirely, delete the whole line.
Example fix
# before squash 4f2a9c1 # after pick 4f2a9c1
Defensive patterns
Strategy: validation
Try / catch
if let Err(err) = parse_integration_steps_script(&script, &divergence) {
// 'line {n}: squash requires at least two commits'
// suggest replacing the line with 'pick <sha>' or deleting it
} Prevention
- When the UI lets users remove commits from a squash group, auto-collapse groups of 1 into a pick line.
- Validate the script with the parser before integration.
When it happens
Trigger: Script line `squash 4f2a9c1` (one commit) or `squash` (none). Often the result of a user deleting one of the commits from a pre-filled squash group.
Common situations: User removes a commit from a squash group the proposal generated, leaving one behind; or intends 'squash into nothing' semantics that the model doesn't have.
Related errors
- line {line_number}: pick does not accept a message clause
- line {line_number}: pick requires exactly one commit
- line {line_number}: merge does not accept a message clause
- line {line_number}: merge requires exactly one commit
- line {line_number}: unknown command '{other}'
AI-assisted analysis of gitbutlerapp/gitbutler@caf1f223d3 (2026-08-20).
Data as JSON: /api/errors/98b1ef80aa80a59f.
Report an issue: GitHub.