{"record":{"id":"5b52985ae32e3006","repo":"mislav/hub","slug":"aborting-creation-due-to-empty-issue-title","errorCode":null,"errorMessage":"Aborting creation due to empty issue title","messagePattern":"Aborting creation due to empty issue title","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"commands/issue.go","lineNumber":602,"sourceCode":"\t} else {\n\t\tmessageBuilder.Edit = true\n\n\t\tworkdir, _ := git.WorkdirName()\n\t\tif workdir != \"\" {\n\t\t\ttemplate, err := github.ReadTemplate(github.IssueTemplate, workdir)\n\t\t\tutils.Check(err)\n\t\t\tif template != \"\" {\n\t\t\t\tmessageBuilder.Message = template\n\t\t\t}\n\t\t}\n\n\t}\n\n\ttitle, body, err := messageBuilder.Extract()\n\tutils.Check(err)\n\n\tif title == \"\" {\n\t\tutils.Check(fmt.Errorf(\"Aborting creation due to empty issue title\"))\n\t}\n\n\tparams := map[string]interface{}{\n\t\t\"title\": title,\n\t\t\"body\":  body,\n\t}\n\n\tsetLabelsFromArgs(params, args)\n\n\tsetAssigneesFromArgs(params, args)\n\n\tsetMilestoneFromArgs(params, args, gh, project)\n\n\targs.NoForward()\n\tif args.Noop {\n\t\tui.Printf(\"Would create issue `%s' for %s\\n\", params[\"title\"], project)\n\t} else {\n\t\tissue, err := gh.CreateIssue(project, params)","sourceCodeStart":584,"sourceCodeEnd":620,"githubUrl":"https://github.com/mislav/hub/blob/5c547ed804368763064e51f3990851e267e88edd/commands/issue.go#L584-L620","documentation":"`gh issue create` extracts the title and body from the message builder (editor, -m flags, or template). If the resulting title is empty, creation is aborted rather than submitting a title-less issue to GitHub, which would reject it. The command treats an empty title as a user-intent abort.","triggerScenarios":"Running `gh issue create` where `messageBuilder.Extract()` returns an empty title — e.g. the editor was saved with no title line, `-m` was passed an empty string, or the first line of the message file was blank.","commonSituations":"Saving the editor buffer without typing a title; automation passing empty `-m \"\"`; templates or scripts that put everything into the body but leave the title line blank; CI environments where the editor opens and closes immediately.","solutions":["Re-run and provide a non-empty title (first line of the editor buffer or `-m \"title\"`).","If scripting, pass the title explicitly: `gh issue create -m \"My title\" -m \"Body text\"`.","Check the issue template — ensure the title placeholder line is replaced, not left empty."],"exampleFix":"// before\ngh issue create -m \"\" -m \"Details here\"   // aborted: empty title\n// after\ngh issue create -m \"Fix login timeout\" -m \"Details here\"","handlingStrategy":"validation","validationCode":"if title == \"\" {\n    fmt.Fprintln(os.Stderr, \"issue title must be non-empty\")\n    os.Exit(2)\n}\n// then: gh issue create -m title -m body","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pass an explicit non-empty `-m` title when scripting.","Check issue templates for leftover blank title placeholders.","Verify editor-saved buffers contain a title before saving.","Validate user-supplied title variables are non-empty before invoking the command."],"tags":["issue","validation","empty-input"],"backgroundTag":"empty-required-field","analyzedSha":"5c547ed804368763064e51f3990851e267e88edd","analyzedAt":"2026-09-01T03:34:15.525Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}