mislav/hub · error

Aborting creation due to empty issue title

Error message

Aborting creation due to empty issue title

What it means

`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.

Source

Thrown at commands/issue.go:602

	} else {
		messageBuilder.Edit = true

		workdir, _ := git.WorkdirName()
		if workdir != "" {
			template, err := github.ReadTemplate(github.IssueTemplate, workdir)
			utils.Check(err)
			if template != "" {
				messageBuilder.Message = template
			}
		}

	}

	title, body, err := messageBuilder.Extract()
	utils.Check(err)

	if title == "" {
		utils.Check(fmt.Errorf("Aborting creation due to empty issue title"))
	}

	params := map[string]interface{}{
		"title": title,
		"body":  body,
	}

	setLabelsFromArgs(params, args)

	setAssigneesFromArgs(params, args)

	setMilestoneFromArgs(params, args, gh, project)

	args.NoForward()
	if args.Noop {
		ui.Printf("Would create issue `%s' for %s\n", params["title"], project)
	} else {
		issue, err := gh.CreateIssue(project, params)

View on GitHub (pinned to 5c547ed804)

Solutions

  1. Re-run and provide a non-empty title (first line of the editor buffer or `-m "title"`).
  2. If scripting, pass the title explicitly: `gh issue create -m "My title" -m "Body text"`.
  3. Check the issue template — ensure the title placeholder line is replaced, not left empty.

Example fix

// before
gh issue create -m "" -m "Details here"   // aborted: empty title
// after
gh issue create -m "Fix login timeout" -m "Details here"
Defensive patterns

Strategy: validation

Validate before calling

if title == "" {
    fmt.Fprintln(os.Stderr, "issue title must be non-empty")
    os.Exit(2)
}
// then: gh issue create -m title -m body

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.

Related errors


AI-assisted analysis of mislav/hub@5c547ed804 (2026-09-01). Data as JSON: /api/errors/5b52985ae32e3006. Report an issue: GitHub.