{"record":{"id":"2995625d07ffdf2d","repo":"gitbutlerapp/gitbutler","slug":"unexpected-trailing-characters-after-quoted-messag","errorCode":null,"errorMessage":"unexpected trailing characters after quoted message","messagePattern":"unexpected trailing characters after quoted message","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/but-workspace/src/branch/integrate_branch_upstream/parsing.rs","lineNumber":208,"sourceCode":"                '\"' => '\"',\n                'n' => '\\n',\n                'r' => '\\r',\n                't' => '\\t',\n                other => bail!(\"unsupported escape sequence '\\\\{other}'\"),\n            };\n            output.push(resolved);\n            escaped = false;\n            continue;\n        }\n\n        match ch {\n            '\\\\' => escaped = true,\n            '\"' => {\n                let trailing = input[index + ch.len_utf8()..].trim();\n                if trailing.is_empty() {\n                    return Ok(output);\n                }\n                bail!(\"unexpected trailing characters after quoted message\");\n            }\n            other => output.push(other),\n        }\n    }\n\n    if escaped {\n        bail!(\"unterminated escape sequence in quoted message\");\n    }\n    bail!(\"unterminated quoted message\")\n}\n\nfn quote_message(message: &str) -> String {\n    let mut out = String::from(\"\\\"\");\n    for ch in message.chars() {\n        match ch {\n            '\\\\' => out.push_str(\"\\\\\\\\\"),\n            '\"' => out.push_str(\"\\\\\\\"\"),\n            '\\n' => out.push_str(\"\\\\n\"),","sourceCodeStart":190,"sourceCodeEnd":226,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/58e5313667b857ef39a730e380af31816a7b1768/crates/but-workspace/src/branch/integrate_branch_upstream/parsing.rs#L190-L226","documentation":"After the closing double quote of a `message=\"...\"` clause, nothing but whitespace may follow on the line. If non-whitespace characters appear after the closing quote, the parser raises this error so no message content is silently truncated or ignored. It surfaces wrapped as `line N: invalid squash message: unexpected trailing characters after quoted message`.","triggerScenarios":"Calling parse_integration_steps_script with a squash line like `squash a b | message=\"done\" extra` or with two message clauses (`message=\"a\" message=\"b\"`). Unterminated quotes can also lead here indirectly (they instead raise `unterminated quoted message`).","commonSituations":"Users append comments after the message (comments must be on their own `#` line), paste duplicated clauses, or an editor leaves stray characters after the closing quote.","solutions":["Remove everything after the closing double quote of the message clause.","Move trailing remarks to their own line starting with `#`, which the parser ignores.","If a second clause was accidentally duplicated, delete the extra `message=\"...\"` occurrence.","Ensure the message itself has all content inside a single pair of escaped quotes."],"exampleFix":"// before (script text)\nsquash 2222222 3333333 | message=\"done\" extra\n// after\nsquash 2222222 3333333 | message=\"done\"\n# extra\n","handlingStrategy":"validation","validationCode":"function validateNoTrailing(line: string, lineNo: number): string | null {\n  const m = line.match(/\\|\\s*message=\"(?:[^\"\\\\]|\\\\.)*\"(.*)$/);\n  if (m && m[1].trim() !== '') return `line ${lineNo}: unexpected trailing characters after quoted message`;\n  return null;\n}","typeGuard":"const noTrailingAfterMessage = (line: string): boolean => {\n  const m = line.match(/\\|\\s*message=\"(?:[^\"\\\\]|\\\\.)*\"(.*)$/);\n  return !m || m[1].trim() === '';\n};","tryCatchPattern":"try {\n  const steps = await parseIntegrationScript(script, divergence);\n} catch (err) {\n  const m = /line (\\d+): invalid squash message: unexpected trailing characters/.exec(String(err));\n  if (m) showEditorErrorAtLine(Number(m[1]), 'remove content after the closing quote of message=\"...\"');\n  else throw err;\n}","preventionTips":["End squash lines immediately after the closing quote of the message.","Put annotations on separate `#` comment lines, never after the message clause.","Avoid duplicating `message=` clauses; one quoted message per squash line."],"tags":["parsing","script-validation","quoting","git"],"backgroundTag":"invalid-argument-format","analyzedSha":"58e5313667b857ef39a730e380af31816a7b1768","analyzedAt":"2026-09-18T06:50:32.052Z","contentChangedAt":"2026-09-18T06:50:32.052Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}