gitbutlerapp/gitbutler · error · anyhow::Error

message must start with a double quote

Error message

message must start with a double quote

What it means

Raised by `parse_quoted_string` (via the squash message clause) when the text after `| message=` does not begin with a double quote. Message values are always double-quoted strings, e.g. `| message="combine fixes"`.

Source

Thrown at crates/but-workspace/src/branch/integrate_branch_upstream/parsing.rs:181

}

fn split_message_clause(line: &str) -> Result<(&str, Option<&str>)> {
    let Some((command_part, message_part)) = line.split_once('|') else {
        return Ok((line, None));
    };
    Ok((command_part.trim_end(), Some(message_part.trim_start())))
}

fn parse_message_clause(clause: &str) -> Result<String> {
    let value = clause
        .strip_prefix("message=")
        .context("expected `message=` after `|`")?;
    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;
        }

View on GitHub (pinned to caf1f223d3)

Solutions

  1. Wrap the message in double quotes: `| message="combine fixes"`.
  2. Escape inner quotes/backslashes as `\"` and `\\`; only \n, \r, \t escapes exist.
  3. When generating scripts programmatically, reuse the same escaping rules as `quote_message` in parsing.rs.

Example fix

# before
squash 4f2a9c1 991b3aa | message=combine fixes

# after
squash 4f2a9c1 991b3aa | message="combine fixes"
Defensive patterns

Strategy: validation

Validate before calling

// Lint the message clause before parsing:
if let Some((_, Some(msg))) = line.split_once('|') {
    let m = msg.trim().strip_prefix("message=").unwrap_or("");
    if !m.starts_with('"') { warn("message must be double-quoted"); }
}

Try / catch

if let Err(err) = parse_integration_steps_script(&script, &divergence) {
    // message-quote errors carry 'line {n}:' context; surface verbatim in the editor
}

Prevention

When it happens

Trigger: Lines like `squash 4f2a 991b | message=combine fixes` or `| message='single quoted'`. The `message=` prefix is stripped and the remainder must start with `"`.

Common situations: Hand-writing the clause without quotes; using single quotes out of shell habit; a UI that inserts the raw message without quoting/escaping (instead of using the `quote_message` helper's format).

Related errors


AI-assisted analysis of gitbutlerapp/gitbutler@caf1f223d3 (2026-08-20). Data as JSON: /api/errors/6914978238e83cf4. Report an issue: GitHub.