{"record":{"id":"ad91de3cf0d18bed","repo":"ElectronNET/Electron.NET","slug":"could-not-parse-version-from-release-notes-header","errorCode":null,"errorMessage":"Could not parse version from release notes header.","messagePattern":"Could not parse version from release notes header\\.","errorType":"exception","errorClass":"BuildAbortedException","httpStatus":null,"severity":"error","filePath":"nuke/ReleaseNotesParser.cs","lineNumber":78,"sourceCode":"\n    private IReadOnlyList<ReleaseNotes> ParseComplexFormat(string[] lines)\n    {\n        var lineIndex = 0;\n        var result = new List<ReleaseNotes>();\n\n        while (true)\n        {\n            if (lineIndex >= lines.Length)\n            {\n                break;\n            }\n\n            // Create release notes.\n            var semVer = SemVersion.Zero;\n            var version = SemVersion.TryParse(lines[lineIndex], out semVer);\n            if (!version)\n            {\n                throw new BuildAbortedException(\"Could not parse version from release notes header.\");\n            }\n\n            var rawVersionLine = lines[lineIndex];\n\n            // Increase the line index.\n            lineIndex++;\n\n            // Parse content.\n            var notes = new List<string>();\n\n            while (true)\n            {\n                // Sanity checks.\n                if (lineIndex >= lines.Length)\n                {\n                    break;\n                }\n","sourceCodeStart":60,"sourceCodeEnd":96,"githubUrl":"https://github.com/ElectronNET/Electron.NET/blob/87cc6f98b6a9c5968d7846c0e775ea713bd0d7b2/nuke/ReleaseNotesParser.cs#L60-L96","documentation":"ParseComplexFormat reads a header line from the release notes and passes it to SemVersion.TryParse to extract the version. When the header line is not a valid semantic version string, the parser cannot build a ReleaseNotes entry and throws BuildAbortedException. This is the complex-format branch of the parser, reached via Parse.","triggerScenarios":"A release notes file in complex format contains a header line (at the current lineIndex) that SemVersion.TryParse cannot parse — e.g. '1.2' or 'v1.2.3' or 'Version 1.2.3' instead of a strict '1.2.3' style version at the start of the line.","commonSituations":"Manually edited CHANGELOG where the version was prefixed with 'v' or a word; two-part version numbers (1.2) lacking the required components; heading markdown ('## 1.2.3') left on the version line; locale/full date accidentally placed where the version is expected.","solutions":["Edit the release notes header line to contain a valid SemVer string exactly where the parser expects it (e.g. '1.2.3', optionally followed by description).","Remove prefixes like 'v', 'Version', or markdown heading markers from the version line.","Use full three-part versions (major.minor.patch) instead of '1.2'.","Compare with a known-good historical revision of the CHANGELOG to restore the expected header format."],"exampleFix":"// before (release notes header)\n## v1.2.3\n// after\n1.2.3","handlingStrategy":"validation","validationCode":"var header = lines.FirstOrDefault(l => !string.IsNullOrWhiteSpace(l));\nif (!SemVersion.TryParse(header?.TrimStart('#', ' ', 'v'), out _))\n    throw new InvalidOperationException($\"Release notes header '{header}' is not a valid semver.\");","typeGuard":null,"tryCatchPattern":"try\n{\n    var notes = parser.Parse(lines);\n}\ncatch (BuildAbortedException ex) when (ex.Message.Contains(\"Could not parse version\"))\n{\n    Logger.Error(\"Fix the version header line in the release notes (use major.minor.patch, no 'v' prefix).\");\n}","preventionTips":["Always write headers as strict major.minor.patch without 'v' or heading markers.","Validate the CHANGELOG with a regex/semver check in CI.","Use a changelog generation tool that emits the parser's expected format.","Review CHANGELOG diffs in PRs for accidental header edits."],"tags":["release-notes","parsing","semver","version"],"backgroundTag":"invalid-date-format","analyzedSha":"87cc6f98b6a9c5968d7846c0e775ea713bd0d7b2","analyzedAt":"2026-09-14T03:09:47.608Z","contentChangedAt":"2026-09-14T03:09:47.608Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}