charmbracelet/gum · error

no options provided, see `gum choose --help`

Error message

no options provided, see `gum choose --help`

What it means

gum choose builds its option list either from flags/arguments or from stdin. When neither source yields any options, Run returns this error telling the developer to consult `gum choose --help`. It exists to fail fast rather than render an empty picker.

Source

Thrown at choose/command.go:28

	"charm.land/bubbles/v2/help"
	"charm.land/bubbles/v2/paginator"
	tea "charm.land/bubbletea/v2"
	"charm.land/gum/v2/internal/stdin"
	"charm.land/gum/v2/internal/timeout"
	"charm.land/gum/v2/internal/tty"
	"charm.land/gum/v2/style"
)

// Run provides a shell script interface for choosing between different through
// options.
func (o Options) Run() error {
	input, _ := stdin.Read(stdin.StripANSI(o.StripANSI))
	if len(o.Options) > 0 && len(o.Selected) == 0 {
		o.Selected = strings.Split(input, o.InputDelimiter)
	} else if len(o.Options) == 0 {
		if input == "" {
			return errors.New("no options provided, see `gum choose --help`")
		}
		o.Options = strings.Split(input, o.InputDelimiter)
	}

	// normalize options into a map
	options := map[string]string{}
	// keep the labels in the user-provided order
	var labels []string
	for _, opt := range o.Options {
		if o.LabelDelimiter == "" {
			options[opt] = opt
			continue
		}
		label, value, ok := strings.Cut(opt, o.LabelDelimiter)
		if !ok {
			return fmt.Errorf("invalid option format: %q", opt)
		}
		labels = append(labels, label)

View on GitHub (pinned to 4d089f9550)

Solutions

  1. Pass options as arguments: gum choose "a" "b" "c"
  2. Pipe non-empty input into gum choose, e.g. `printf 'a\nb\n' | gum choose`
  3. Verify the upstream command producing the piped list actually emits data before invoking gum choose

Example fix

// before
printf '' | gum choose  # error: no options provided
// after
printf 'apple\nbanana\n' | gum choose
Defensive patterns

Strategy: validation

Validate before calling

input=$(some_command)
[ -n "$input" ] && printf '%s\n' "$input" | gum choose || echo 'no options available'

Type guard

null

Try / catch

null

Prevention

When it happens

Trigger: Options.Run() is called with len(o.Options)==0 and stdin read yields an empty string — i.e. no positional/flag options were given and stdin was empty or closed.

Common situations: Scripting `gum choose` in a pipeline where the upstream command produced no output; piping an empty variable (e.g. `echo "$EMPTY" | gum choose`); forgetting that stdin is consumed only when no options are passed.

Related errors


AI-assisted analysis of charmbracelet/gum@4d089f9550 (2026-08-31). Data as JSON: /api/errors/9d803eddb4972169. Report an issue: GitHub.