{"record":{"id":"6a7167e1e2039f93","repo":"gitbutlerapp/gitbutler","slug":"unterminated-escape-sequence-in-quoted-message","errorCode":null,"errorMessage":"unterminated escape sequence in quoted message","messagePattern":"unterminated escape sequence in quoted message","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/but-workspace/src/branch/integrate_branch_upstream/parsing.rs","lineNumber":215,"sourceCode":"            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\"),\n            '\\r' => out.push_str(\"\\\\r\"),\n            '\\t' => out.push_str(\"\\\\t\"),\n            other => out.push(other),\n        }\n    }\n    out.push('\"');\n    out","sourceCodeStart":197,"sourceCodeEnd":233,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/caf1f223d3cfb94488c9198ad34487c6006c648f/crates/but-workspace/src/branch/integrate_branch_upstream/parsing.rs#L197-L233","documentation":"Raised by `parse_quoted_string` when the message ends immediately after a backslash with no following character — the escape was started but the input (line) ended, so the escape cannot be resolved.","triggerScenarios":"A line like `squash 4f2a 991b | message=\"trailing backslash\\` where the final backslash is the last character before end of input.","commonSituations":"Truncated scripts (editor cut off the line), or a literal Windows-path-style trailing backslash that was not doubled.","solutions":["Double the trailing backslash (`\\\\`) or delete it.","If the script looks truncated, re-render it and re-apply edits."],"exampleFix":"# before\nsquash 4f2a 991b | message=\"path ends with \\ \n\n# after\nsquash 4f2a 991b | message=\"path ends with \\\\\"","handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":"if let Err(err) = parse_integration_steps_script(&script, &divergence) {\n    if err.to_string().contains(\"unterminated escape sequence\") {\n        // line ends with a lone backslash; double it or remove it\n    }\n}","preventionTips":["Double any trailing backslash in messages (Windows paths).","Regenerate truncated scripts instead of hand-repairing them."],"tags":["rust","git","but-workspace","integration","todo-script","parsing","quoting","escape-sequence"],"backgroundTag":"unterminated-string-literal","analyzedSha":"caf1f223d3cfb94488c9198ad34487c6006c648f","analyzedAt":"2026-08-20T07:55:40.983Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}