{"record":{"id":"5be0f01ee07fd296","repo":"GitoxideLabs/gitoxide","slug":"duplicate-message-header","errorCode":null,"errorMessage":"duplicate Message header","messagePattern":"duplicate Message header","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"gix-tix/src/edit/reword.rs","lineNumber":384,"sourceCode":"    let mut consumed = 0;\n    for line in remainder.lines_with_terminator() {\n        consumed += line.len();\n        let line = trim_cr(line.strip_suffix(b\"\\n\").unwrap_or(line));\n        if line.is_empty() {\n            message_offset = Some(consumed);\n            break;\n        }\n        if line.starts_with(comment_char) {\n            continue;\n        }\n        if line == TODO {\n            if std::mem::replace(&mut todo_seen, true) {\n                anyhow::bail!(\"duplicate Todo header\");\n            }\n            enrichment.todo = true;\n        } else if let Some(title) = line.strip_prefix(MESSAGE) {\n            if std::mem::replace(&mut message_seen, true) {\n                anyhow::bail!(\"duplicate Message header\");\n            }\n            let title = title.trim();\n            enrichment.message = (!title.is_empty()).then(|| title.into());\n        } else {\n            anyhow::bail!(\"unknown commit header: {}\", line.as_bstr());\n        }\n    }\n    let message_offset = message_offset.context(\"expected an empty line after the commit headers\")?;\n    let message = cleanup_message(\n        remainder\n            .get(message_offset..)\n            .context(\"the commit message is missing\")?,\n        Some(comment_char),\n    );\n    Ok(Edit {\n        author,\n        author_time,\n        committer,","sourceCodeStart":366,"sourceCodeEnd":402,"githubUrl":"https://github.com/GitoxideLabs/gitoxide/blob/e73179060badf27222d790981fac3f84c1830a7e/gix-tix/src/edit/reword.rs#L366-L402","documentation":"The edit document must contain the `Message` header at most once. `parse` uses a `message_seen` flag and bails with this error if a second `Message` line is encountered, since the title/enrichment could not be resolved unambiguously.","triggerScenarios":"Calling `parse` (from `apply_conflict_reporting` or the parse tests) on a document whose body contains two or more lines starting with the `MESSAGE` prefix.","commonSituations":"Scripts appending an extra `Message:` line; merged or concatenated edit documents; a user pasting the message twice in the editor in header position.","solutions":["Keep exactly one `Message` header; delete the extra one.","Move message content into the free-form message section below the headers instead of adding more `Message` lines.","Regenerate the document via `document()` to get a well-formed header block."],"exampleFix":"// before\nMessage: first title\nMessage: second title\n// after\nMessage: first title","handlingStrategy":"validation","validationCode":"fn message_header_count(body: &[&[u8]]) -> usize {\n    body.iter().filter(|l| l.starts_with(MESSAGE)).count()\n}","typeGuard":null,"tryCatchPattern":"match parse(&edited) {\n    Ok(doc) => doc,\n    Err(e) if e.to_string().contains(\"duplicate Message header\") => {\n        eprintln!(\"Keep exactly one Message header; extra lines belong in the message body.\");\n        Err(e)\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Put long or multi-line text in the message section, not in additional Message headers.","Editor tooling should deduplicate header lines on save.","Validate header uniqueness before parsing in automated pipelines."],"tags":["git","parsing","duplicate-header","reword","validation"],"backgroundTag":"schema-validation-failed","analyzedSha":"e73179060badf27222d790981fac3f84c1830a7e","analyzedAt":"2026-09-08T11:26:50.865Z","contentChangedAt":"2026-09-08T11:26:50.865Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}