gitbutlerapp/gitbutler · error · anyhow::Error

unexpected trailing characters after quoted message

Error message

unexpected trailing characters after quoted message

What it means

Raised by `parse_quoted_string` when the closing double quote is followed by non-whitespace text. After the terminating quote only trailing whitespace may remain on the message clause.

Source

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

                '"' => '"',
                '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),
        }
    }

    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"),

View on GitHub (pinned to caf1f223d3)

Solutions

  1. End the line right after the closing quote: `| message="done"`.
  2. If multiple messages were intended, merge them into one quoted string.

Example fix

# before
squash 4f2a 991b | message="done" (final)

# after
squash 4f2a 991b | message="done (final)"
Defensive patterns

Strategy: validation

Try / catch

if let Err(err) = parse_integration_steps_script(&script, &divergence) {
    // 'unexpected trailing characters after quoted message' — point at text after the closing quote
}

Prevention

When it happens

Trigger: Lines like `| message="done" extra` or `| message="a" "b"` — anything after the closing quote that is not blank.

Common situations: Two messages appended; a stray character or second quoted segment after the message; UI concatenation bugs gluing text after the quote.

Related errors


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