{"record":{"id":"b0d0767ececc8bc7","repo":"go-task/task","slug":"no-options-provided","errorCode":null,"errorMessage":"no options provided","messagePattern":"no options provided","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/input/input.go","lineNumber":56,"sourceCode":"\t)\n\n\tresult, err := prog.Run()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tmodel := result.(textModel)\n\tif model.cancelled {\n\t\treturn \"\", ErrCancelled\n\t}\n\n\treturn model.value, nil\n}\n\n// Select prompts the user to select from a list of options\nfunc (p *Prompter) Select(varName string, options []string) (string, error) {\n\tif len(options) == 0 {\n\t\treturn \"\", errors.New(\"no options provided\")\n\t}\n\n\tm := newSelectModel(varName, options)\n\n\tprog := tea.NewProgram(m,\n\t\ttea.WithInput(p.Stdin),\n\t\ttea.WithOutput(p.Stderr),\n\t)\n\n\tresult, err := prog.Run()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tmodel := result.(selectModel)\n\tif model.cancelled {\n\t\treturn \"\", ErrCancelled\n\t}","sourceCodeStart":38,"sourceCodeEnd":74,"githubUrl":"https://github.com/go-task/task/blob/385e5ad92af02877b6d7cf9dcc963b5ed916e70a/internal/input/input.go#L38-L74","documentation":"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.","triggerScenarios":"Calling Prompter.Select(varName, options) where len(options)==0, typically because the caller computed choices from data that turned out empty.","commonSituations":"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.","solutions":["Ensure the options source (var enum, dynamic command output) returns at least one entry before prompting","Skip the Select call and use a default when the list is empty","Check len(options) > 0 at the call site"],"exampleFix":"// before\nchoice, _ := p.Select(\"env\", opts) // opts may be empty\n// after\nif len(opts) == 0 {\n    opts = []string{\"default\"}\n}\nchoice, _ := p.Select(\"env\", opts)","handlingStrategy":"validation","validationCode":"if len(options) == 0 {\n    options = []string{fallback}\n}\nchoice, err := p.Select(\"name\", options)","typeGuard":"func hasOptions(opts []string) bool {\n    return len(opts) > 0\n}","tryCatchPattern":"choice, err := p.Select(\"name\", options)\nif err != nil {\n    return fmt.Errorf(\"select prompt failed: %w\", err)\n}","preventionTips":["Validate dynamic option sources (enum vars, command output) before prompting","Provide a sensible default option list for every Select call","Unit-test var resolution so empty lists are caught early"],"tags":["prompt","select","empty-input"],"backgroundTag":"empty-options-prompt","analyzedSha":"385e5ad92af02877b6d7cf9dcc963b5ed916e70a","analyzedAt":"2026-09-05T09:01:05.226Z","contentChangedAt":"2026-09-05T09:01:05.226Z","schemaVersion":2},"datasetVersion":"2026-09-12T12:17:11.808Z"}