gitbutlerapp/gitbutler · error
unterminated quoted message
Error message
unterminated quoted message
What it means
parse_quoted_string consumed the entire input without finding the closing double quote for a quoted message. The parser requires a balanced quoted string; running out of characters while still inside the quotes is a hard parse failure because the message boundary is unknown.
Solutions
- Add the missing closing double quote at the end of the message clause
- Regenerate the plan/editor input using quote_message() which always wraps the message in quotes
- Check for accidental truncation of the input file or string before parsing
Example fix
// before "fix: handle path // after "fix: handle path"
Defensive patterns
Strategy: validation
Validate before calling
fn has_closing_quote(s: &str) -> bool {
let mut escaped = false;
for (i, b) in s.bytes().enumerate() {
if i == 0 { continue; }
if escaped { escaped = false; continue; }
match b { b'\\' => escaped = true, b'"' => return true, _ => {} }
}
false
} Try / catch
match parse_message_clause(input) {
Err(e) if e.to_string().contains("unterminated quoted message") => eprintln!("missing closing quote in: {input}"),
other => other?,
} Prevention
- Never hand-edit quoted message clauses in plan files; use the library's quoting API
- Validate editor output for balanced quotes before persisting
- Guard against truncation when writing generated input files
When it happens
Trigger: Calling parse_message_clause with input where the message clause starts with `"` but the closing `"` is missing, e.g. `"unterminated message` at end of input.
Common situations: Truncated editor buffers, user deleting the closing quote while editing a plan file, or template generation that failed to append the final quote character.
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
- commit prefix ' ' is ambiguous
- commit ' ' is not part of the editable divergence
- Failed to parse branch_ref_bytes
- line : invalid merge commit
- line : invalid pick commit
AI-assisted analysis of gitbutlerapp/gitbutler@58e5313667 (2026-09-18).
Data as JSON: /api/errors/0c171dc109d17186.
Report an issue: GitHub.
Appendix: 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 58e5313667)