gitbutlerapp/gitbutler · error · anyhow::Error
unterminated quoted message
Error message
unterminated quoted message
What it means
Raised by `parse_quoted_string` when the whole message clause is consumed without ever finding a closing double quote. The opening quote was seen, but the string literal never terminates on that line.
Source
Thrown at crates/but-workspace/src/branch/integrate_branch_upstream/parsing.rs:217
}
match ch {
'\\' => escaped = true,
'"' => {
let trailing = input[index + ch.len_utf8()..].trim();
if trailing.is_empty() {
return Ok(output);
}
bail!("unexpected trailing characters after quoted message");
}
other => output.push(other),
}
}
if escaped {
bail!("unterminated escape sequence in quoted message");
}
bail!("unterminated quoted message")
}
fn quote_message(message: &str) -> String {
let mut out = String::from("\"");
for ch in message.chars() {
match ch {
'\\' => out.push_str("\\\\"),
'"' => out.push_str("\\\""),
'\n' => out.push_str("\\n"),
'\r' => out.push_str("\\r"),
'\t' => out.push_str("\\t"),
other => out.push(other),
}
}
out.push('"');
out
}
View on GitHub (pinned to caf1f223d3)
Solutions
- Close the string: `| message="finished"`.
- Escape any inner double quote as `\"` and express newlines as `\n`, not actual line breaks.
- Regenerate the line with the same rules `quote_message` uses when in doubt.
Example fix
# before squash 4f2a 991b | message="combine "fixes" and more # after squash 4f2a 991b | message="combine \"fixes\" and more"
Defensive patterns
Strategy: validation
Try / catch
if let Err(err) = parse_integration_steps_script(&script, &divergence) {
if err.to_string().contains("unterminated quoted message") {
// missing close quote or unescaped inner quote; newlines must be literal \n
}
} Prevention
- Escape inner double quotes as \"; write newlines as \n (raw multi-line messages are not supported).
- Let the UI generate the clause from a plain-text message field instead of free-form editing.
When it happens
Trigger: Lines like `squash 4f2a 991b | message="unfinished` — missing close quote, possibly because the message itself contains an unescaped `"` that closed it early and left the rest dangling, or the line was cut short.
Common situations: User omits the closing quote; newline intended inside the message must be written as the literal `\n` escape (raw multi-line messages are impossible since the grammar is line-based); unescaped inner quote ends the literal prematurely.
Related errors
- message must start with a double quote
- unsupported escape sequence '\{other}'
- unexpected trailing characters after quoted message
- unterminated escape sequence in quoted message
- line {line_number}: pick does not accept a message clause
AI-assisted analysis of gitbutlerapp/gitbutler@caf1f223d3 (2026-08-20).
Data as JSON: /api/errors/0c171dc109d17186.
Report an issue: GitHub.