{"record":{"id":"eb390c26a6b7179d","repo":"vectordotdev/vector","slug":"exactly-one-migration-section-is-required","errorCode":null,"errorMessage":"exactly one `## Migration` section is required","messagePattern":"exactly one `## Migration` section is required","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"vdev/src/commands/changelog/mod.rs","lineNumber":137,"sourceCode":"    let body: &str = &normalized;\n\n    // 1) File must begin with an H1 title on the first line — no leading blank lines.\n    let title_body = body\n        .strip_prefix(\"# \")\n        .ok_or_else(|| anyhow::anyhow!(\"first line must be an H1 title (`# ...`)\"))?;\n    let (title_line, after_title) = title_body.split_once('\\n').unwrap_or((title_body, \"\"));\n    let (title_text, anchor) = split_title_and_anchor(title_line);\n    let title = title_text.to_string();\n    if title.is_empty() {\n        bail!(\"H1 title must not be empty\");\n    }\n\n    // 2) Exactly one `## Summary` and one `## Migration`, in that order.\n    if after_title.matches(SUMMARY_MARKER).count() != 1 {\n        bail!(\"exactly one `## Summary` section is required\");\n    }\n    if after_title.matches(MIGRATION_MARKER).count() != 1 {\n        bail!(\"exactly one `## Migration` section is required\");\n    }\n    let s_pos = after_title.find(SUMMARY_MARKER).unwrap();\n    let m_pos = after_title.find(MIGRATION_MARKER).unwrap();\n    if s_pos >= m_pos {\n        bail!(\"`## Summary` must come before `## Migration`\");\n    }\n\n    // Reject any prose between the H1 title and `## Summary`. Someone hand-migrating an\n    // old free-form breaking fragment could carry over the previous body here and it\n    // would silently disappear from both the release CUE and the upgrade guide.\n    // Everything before Summary must be whitespace (`\\n## Summary\\n` starts with the\n    // leading newline, so `s_pos` includes it).\n    if let Some(prefix) = after_title.get(..s_pos)\n        && !prefix.trim().is_empty()\n    {\n        bail!(\n            \"content between the title and `## Summary` is not allowed — move it into `## Summary` or `## Migration`.\"\n        );","sourceCodeStart":119,"sourceCodeEnd":155,"githubUrl":"https://github.com/vectordotdev/vector/blob/bdb87aeaa4c4ff27c0ba643c1c77b21bf2ef4013/vdev/src/commands/changelog/mod.rs#L119-L155","documentation":"`parse_breaking_sections` requires a breaking fragment to contain exactly one `## Migration` section. If the text after the H1 title contains zero or multiple occurrences of MIGRATION_MARKER, it bails with this error. The Migration section is mandatory so every breaking change ships with upgrade instructions.","triggerScenarios":"Parsing a breaking fragment that omits `## Migration`, uses a different casing/heading level, or contains the `## Migration` heading more than once.","commonSituations":"Deleting the template's Migration section because \"nothing to migrate\"; duplicating the heading while reorganizing content; migrating legacy fragments that lacked the section.","solutions":["Add exactly one `## Migration` section after `## Summary`.","Merge duplicated `## Migration` sections into one.","Use the `vdev changelog new` template so both required sections exist."],"exampleFix":"// before\n# My change\n## Summary\nSomething broke.\n// after\n# My change\n## Summary\nSomething broke.\n## Migration\nUse the new option instead.","handlingStrategy":"validation","validationCode":"let migration_count = text.matches(\"## Migration\").count();\nif migration_count != 1 {\n    eprintln!(\"fragment must contain exactly one '## Migration' (found {migration_count})\");\n}","typeGuard":null,"tryCatchPattern":"if let Err(e) = parse_breaking_sections(text) {\n    eprintln!(\"fix fragment structure: {e}\");\n}","preventionTips":["Keep the template's `## Migration` section; write \"No action required.\" if trivial.","Merge duplicated Migration sections rather than keeping both.","Run validation before opening the PR."],"tags":["changelog","validation","markdown"],"backgroundTag":"missing-required-config-field","analyzedSha":"bdb87aeaa4c4ff27c0ba643c1c77b21bf2ef4013","analyzedAt":"2026-09-16T02:53:35.741Z","contentChangedAt":"2026-09-16T02:53:35.741Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}