gitbutlerapp/gitbutler · error

message must start with a double quote

Error message

message must start with a double quote

What it means

Inline messages in `squash` steps are parsed by `parse_message_clause` -> `parse_quoted_string`, which requires the value after `message=` to be a double-quoted string. This error is raised when the character immediately following `message=` is not `"` (e.g. `message=hello` or `message='hello'`). It surfaces wrapped as `line N: invalid squash message: message must start with a double quote`.

Solutions

  1. Wrap the message in double quotes: `squash a b | message="my message"`.
  2. Escape inner double quotes and backslashes with `\` (supported escapes: `\\`, `\"`, `\n`, `\r`, `\t`).
  3. Remove the `| message=...` clause entirely if the combined commit should keep the default (first) commit message.

Example fix

// before (script text)
squash 2222222 3333333 | message=combined
// after
squash 2222222 3333333 | message="combined"
Defensive patterns

Strategy: validation

Validate before calling

function validateMessageClause(line: string, lineNo: number): string | null {
  const m = line.match(/\|\s*message=(.)/);
  if (m && m[1] !== '"') return `line ${lineNo}: message must start with a double quote`;
  return null;
}

Type guard

const messageIsDoubleQuoted = (line: string): boolean => {
  const m = line.match(/\|\s*message=(.)/);
  return !m || m[1] === '"';
};

Try / catch

try {
  const steps = await parseIntegrationScript(script, divergence);
} catch (err) {
  if (/invalid squash message: message must start with a double quote/.test(String(err))) {
    showEditorHint('wrap squash messages in double quotes: message="text"');
  } else throw err;
}

Prevention

When it happens

Trigger: Calling parse_integration_steps_script with a squash line like `squash a b | message=unquoted` or `squash a b | message='single quoted'`. Any content after `|` that does not start with `message="` may also trip the earlier `expected message=` context error.

Common situations: Users type a message without quotes, use single quotes (shell habit), or forget the quotes after deleting part of the clause while editing.

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


AI-assisted analysis of gitbutlerapp/gitbutler@58e5313667 (2026-09-18). Data as JSON: /api/errors/6914978238e83cf4. Report an issue: GitHub.

Appendix: 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 58e5313667)