go-task/task · error

no options provided

Error message

no options provided

What it means

Prompter.Select refuses to start a selection prompt when the options slice is empty, since there is nothing to render or choose from. It is a programming/API-misuse guard, raised before any terminal I/O.

Source

Thrown at internal/input/input.go:56

	)

	result, err := prog.Run()
	if err != nil {
		return "", err
	}

	model := result.(textModel)
	if model.cancelled {
		return "", ErrCancelled
	}

	return model.value, nil
}

// Select prompts the user to select from a list of options
func (p *Prompter) Select(varName string, options []string) (string, error) {
	if len(options) == 0 {
		return "", errors.New("no options provided")
	}

	m := newSelectModel(varName, options)

	prog := tea.NewProgram(m,
		tea.WithInput(p.Stdin),
		tea.WithOutput(p.Stderr),
	)

	result, err := prog.Run()
	if err != nil {
		return "", err
	}

	model := result.(selectModel)
	if model.cancelled {
		return "", ErrCancelled
	}

View on GitHub (pinned to 385e5ad92a)

Solutions

  1. Ensure the options source (var enum, dynamic command output) returns at least one entry before prompting
  2. Skip the Select call and use a default when the list is empty
  3. Check len(options) > 0 at the call site

Example fix

// before
choice, _ := p.Select("env", opts) // opts may be empty
// after
if len(opts) == 0 {
    opts = []string{"default"}
}
choice, _ := p.Select("env", opts)
Defensive patterns

Strategy: validation

Validate before calling

if len(options) == 0 {
    options = []string{fallback}
}
choice, err := p.Select("name", options)

Type guard

func hasOptions(opts []string) bool {
    return len(opts) > 0
}

Try / catch

choice, err := p.Select("name", options)
if err != nil {
    return fmt.Errorf("select prompt failed: %w", err)
}

Prevention

When it happens

Trigger: Calling Prompter.Select(varName, options) where len(options)==0, typically because the caller computed choices from data that turned out empty.

Common situations: Task generates select options from vars/enums that resolved to an empty list (e.g. a dynamic var command returned nothing), then attempts to prompt.

Related errors


AI-assisted analysis of go-task/task@385e5ad92a (2026-09-05). Data as JSON: /api/errors/b0d0767ececc8bc7. Report an issue: GitHub.