gitbutlerapp/gitbutler · error · anyhow::Error
unsupported escape sequence '\{other}'
Error message
unsupported escape sequence '\{other}' What it means
Raised by `parse_quoted_string` when a backslash escape inside a quoted squash message is followed by a character other than the supported set. Only `\\`, `\"`, `\n`, `\r`, `\t` are recognized.
Source
Thrown at crates/but-workspace/src/branch/integrate_branch_upstream/parsing.rs:194
parse_quoted_string(value)
}
fn parse_quoted_string(input: &str) -> Result<String> {
if !input.starts_with('"') {
bail!("message must start with a double quote");
}
let mut output = String::new();
let mut escaped = false;
for (index, ch) in input.char_indices().skip(1) {
if escaped {
let resolved = match ch {
'\\' => '\\',
'"' => '"',
'n' => '\n',
'r' => '\r',
't' => '\t',
other => bail!("unsupported escape sequence '\\{other}'"),
};
output.push(resolved);
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),
}
}View on GitHub (pinned to caf1f223d3)
Solutions
- Replace the unsupported escape: double the backslash for a literal one (`\\`), or remove it.
- Keep control characters to the supported set (\n, \r, \t); anything else must be written literally.
Example fix
# before squash 4f2a 991b | message="match \d+ exactly" # after squash 4f2a 991b | message="match \\d+ exactly"
Defensive patterns
Strategy: validation
Try / catch
if let Err(err) = parse_integration_steps_script(&script, &divergence) {
if err.to_string().contains("unsupported escape sequence") {
// tell user only \\ \" \n \r \t are allowed
}
} Prevention
- Escape backslashes by doubling them; only \n \r \t escapes exist.
- Generate messages programmatically instead of hand-typing when they contain backslashes.
When it happens
Trigger: A message containing e.g. `\x22`, `\'`, `\0`, or a literal backslash before an unrelated char: `| message="path C:\\temp"` is fine but `"\d+"` bails.
Common situations: Messages with regex snippets, Windows paths written with single backslashes, or JSON-ish content pasted into the message where `\uXXXX`/`\x` escapes are expected.
Related errors
- unterminated escape sequence in quoted message
- 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/88bb5df34c4b51e0.
Report an issue: GitHub.