{"record":{"id":"383f90f6d79be26b","repo":"mislav/hub","slug":"aborting-editing-due-to-empty-release-title","errorCode":null,"errorMessage":"Aborting editing due to empty release title","messagePattern":"Aborting editing due to empty release title","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"commands/release.go","lineNumber":606,"sourceCode":"\n\tflagReleaseMessage := args.Flag.AllValues(\"--message\")\n\tif len(flagReleaseMessage) > 0 {\n\t\tmessageBuilder.Message = strings.Join(flagReleaseMessage, \"\\n\\n\")\n\t\tmessageBuilder.Edit = args.Flag.Bool(\"--edit\")\n\t} else if args.Flag.HasReceived(\"--file\") {\n\t\tmessageBuilder.Message, err = msgFromFile(args.Flag.Value(\"--file\"))\n\t\tutils.Check(err)\n\t\tmessageBuilder.Edit = args.Flag.Bool(\"--edit\")\n\t} else {\n\t\tmessageBuilder.Edit = true\n\t\tmessageBuilder.Message = strings.Replace(fmt.Sprintf(\"%s\\n\\n%s\", release.Name, release.Body), \"\\r\\n\", \"\\n\", -1)\n\t}\n\n\ttitle, body, err := messageBuilder.Extract()\n\tutils.Check(err)\n\n\tif title == \"\" && len(flagReleaseMessage) == 0 {\n\t\tutils.Check(fmt.Errorf(\"Aborting editing due to empty release title\"))\n\t}\n\n\tif title != \"\" {\n\t\tparams[\"name\"] = title\n\t}\n\tif body != \"\" {\n\t\tparams[\"body\"] = body\n\t}\n\n\targs.NoForward()\n\tif len(params) > 0 {\n\t\tif args.Noop {\n\t\t\tui.Printf(\"Would edit release `%s'\\n\", tagName)\n\t\t} else {\n\t\t\trelease, err = gh.EditRelease(release, params)\n\t\t\tutils.Check(err)\n\t\t}\n","sourceCodeStart":588,"sourceCodeEnd":624,"githubUrl":"https://github.com/mislav/hub/blob/5c547ed804368763064e51f3990851e267e88edd/commands/release.go#L588-L624","documentation":"editRelease extracts the new title/body from the editor or message input; the title check is skipped only when `--notes`-style messages (flagReleaseMessage) are supplied, since then the name is intentionally left untouched. If the extracted title is empty and no release message flags were given, editing aborts to avoid blanking the release name.","triggerScenarios":"`gh release edit` where `messageBuilder.Extract()` yields title == \"\" and len(flagReleaseMessage) == 0 — the title line was emptied in the editor and no --notes/--message-style flags were provided.","commonSituations":"Clearing the prefilled title while only intending to edit the notes; passing an empty --file; forgetting that editing requires either a title or explicit message flags.","solutions":["Keep/provide a title (first line of the editor message or the CLI title argument).","Pass explicit release message flags (e.g. --notes) so only the body changes and the title is preserved.","Fix the --file input to include a non-empty first line if a title change is intended."],"exampleFix":"// before\ngh release edit v1.0.0   # cleared the title in the editor\n// after\ngh release edit v1.0.0 --notes \"Updated release notes\"  # title preserved","handlingStrategy":"validation","validationCode":"title, _, err := messageBuilder.Extract()\nif err != nil {\n    return err\n}\nif strings.TrimSpace(title) == \"\" && len(flagReleaseMessage) == 0 {\n    return errors.New(\"provide a title or --notes to edit a release\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["When only editing notes, use --notes instead of clearing the title.","Don't empty the prefilled title in the editor.","Give --file inputs a non-empty first line."],"tags":["release","validation","cli"],"backgroundTag":"empty-required-field","analyzedSha":"5c547ed804368763064e51f3990851e267e88edd","analyzedAt":"2026-09-01T03:34:15.525Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}