gitbutlerapp/gitbutler · error
line : invalid squash message
Error message
line {line_number}: invalid squash message: {err} What it means
Thrown while parsing an edited integration script when the optional message clause on a 'squash' line (the text after a separator, parsed by parse_message_clause) is malformed. The step's command and commits were fine, but the inline message portion does not satisfy the clause grammar (e.g. wrong quoting or empty content).
Solutions
- Fix the message clause on the reported line — quote the message correctly per the script grammar (mirror the rendering in render_step).
- Remove the message clause entirely to let the squash use the default combined message.
- Re-copy the line from the originally rendered script and re-apply the edit carefully.
- Round-trip the edit through render_integration_steps_script/parse_integration_steps_script in tests to confirm the clause grammar.
Example fix
// before squash a1b2c3d4... e4f5g6h7... | "unclosed message // after squash a1b2c3d4... e4f5g6h7... | "properly closed message"
Defensive patterns
Strategy: validation
Validate before calling
// check the message clause quotes are balanced before saving
fn message_clause_ok(line: &str) -> bool {
line.matches('"').count() % 2 == 0
} Try / catch
match parse_integration_steps_script(&edited, &divergence) {
Err(e) if e.to_string().contains("invalid squash message") => {
reopen_editor_with_error_note(&e.to_string())?;
}
other => other?,
} Prevention
- Match the exact message-clause format produced by render_integration_steps_script.
- Quote messages containing spaces or special characters exactly as rendered.
- Delete the message clause rather than leaving it empty/broken.
- Round-trip render→parse in tests whenever the clause grammar changes.
When it happens
Trigger: parse_integration_steps_script encountering 'squash <c1> <c2> | <message>' (or however the message clause is delimited) where parse_message_clause rejects the message — unbalanced quotes, empty message, or an invalid clause format.
Common situations: Hand-editing the todo and breaking the quoting around a message with special characters; deleting the message content while keeping the clause separator; adding a message clause to a line format that expects none.
Understand the failure class
Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.
Related errors
- line : invalid merge commit
- line : invalid pick commit
- line : invalid squash commit
- commit ' ' is not part of the editable divergence
- Integration steps cannot be empty
AI-assisted analysis of gitbutlerapp/gitbutler@58e5313667 (2026-09-18).
Data as JSON: /api/errors/489c1b9ba82aaae4.
Report an issue: GitHub.
Appendix: source
Thrown at crates/but-workspace/src/branch/integrate_branch_upstream/parsing.rs:97
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}")
})?,
}
}
other => bail!("line {line_number}: unknown command '{other}'"),
};
steps.push(step);
}
Ok(steps)
}
fn render_step(step: &InteractiveIntegrationStep) -> String {
match step {
InteractiveIntegrationStep::Pick { commit_id } => format!("pick {}", short_id(*commit_id)),
InteractiveIntegrationStep::Merge { commit_id } => {
format!("merge {}", short_id(*commit_id))
}
InteractiveIntegrationStep::Squash { commits, message } => {View on GitHub (pinned to 58e5313667)