{"record":{"id":"0c171dc109d17186","repo":"gitbutlerapp/gitbutler","slug":"unterminated-quoted-message","errorCode":null,"errorMessage":"unterminated quoted message","messagePattern":"unterminated quoted message","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/but-workspace/src/branch/integrate_branch_upstream/parsing.rs","lineNumber":217,"sourceCode":"        }\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\n}\n","sourceCodeStart":199,"sourceCodeEnd":235,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/58e5313667b857ef39a730e380af31816a7b1768/crates/but-workspace/src/branch/integrate_branch_upstream/parsing.rs#L199-L235","documentation":"parse_quoted_string consumed the entire input without finding the closing double quote for a quoted message. The parser requires a balanced quoted string; running out of characters while still inside the quotes is a hard parse failure because the message boundary is unknown.","triggerScenarios":"Calling parse_message_clause with input where the message clause starts with `\"` but the closing `\"` is missing, e.g. `\"unterminated message` at end of input.","commonSituations":"Truncated editor buffers, user deleting the closing quote while editing a plan file, or template generation that failed to append the final quote character.","solutions":["Add the missing closing double quote at the end of the message clause","Regenerate the plan/editor input using quote_message() which always wraps the message in quotes","Check for accidental truncation of the input file or string before parsing"],"exampleFix":"// before\n\"fix: handle path\n// after\n\"fix: handle path\"","handlingStrategy":"validation","validationCode":"fn has_closing_quote(s: &str) -> bool {\n    let mut escaped = false;\n    for (i, b) in s.bytes().enumerate() {\n        if i == 0 { continue; }\n        if escaped { escaped = false; continue; }\n        match b { b'\\\\' => escaped = true, b'\"' => return true, _ => {} }\n    }\n    false\n}","typeGuard":null,"tryCatchPattern":"match parse_message_clause(input) {\n    Err(e) if e.to_string().contains(\"unterminated quoted message\") => eprintln!(\"missing closing quote in: {input}\"),\n    other => other?,\n}","preventionTips":["Never hand-edit quoted message clauses in plan files; use the library's quoting API","Validate editor output for balanced quotes before persisting","Guard against truncation when writing generated input files"],"tags":["parsing","git","quote"],"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"}