gitbutlerapp/gitbutler · error · anyhow::Error
unterminated escape sequence in quoted message
Error message
unterminated escape sequence in quoted message
What it means
Raised by `parse_quoted_string` when the message ends immediately after a backslash with no following character — the escape was started but the input (line) ended, so the escape cannot be resolved.
Source
Thrown at crates/but-workspace/src/branch/integrate_branch_upstream/parsing.rs:215
escaped = false;
continue;
}
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('"');
outView on GitHub (pinned to caf1f223d3)
Solutions
- Double the trailing backslash (`\\`) or delete it.
- If the script looks truncated, re-render it and re-apply edits.
Example fix
# before squash 4f2a 991b | message="path ends with \ # after squash 4f2a 991b | message="path ends with \\"
Defensive patterns
Strategy: validation
Try / catch
if let Err(err) = parse_integration_steps_script(&script, &divergence) {
if err.to_string().contains("unterminated escape sequence") {
// line ends with a lone backslash; double it or remove it
}
} Prevention
- Double any trailing backslash in messages (Windows paths).
- Regenerate truncated scripts instead of hand-repairing them.
When it happens
Trigger: A line like `squash 4f2a 991b | message="trailing backslash\` where the final backslash is the last character before end of input.
Common situations: Truncated scripts (editor cut off the line), or a literal Windows-path-style trailing backslash that was not doubled.
Related errors
- unsupported escape sequence '\{other}'
- message must start with a double quote
- unexpected trailing characters after quoted message
- unterminated 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/6a7167e1e2039f93.
Report an issue: GitHub.