{"record":{"id":"c6c374cc3506be61","repo":"charmbracelet/gum","slug":"nothing-selected","errorCode":null,"errorMessage":"nothing selected","messagePattern":"nothing selected","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"choose/command.go","lineNumber":158,"sourceCode":"\t\thelp:              help.New(),\n\t\tkeymap:            km,\n\t}\n\n\tctx, cancel := timeout.Context(o.Timeout)\n\tdefer cancel()\n\n\t// Disable Keybindings since we will control it ourselves.\n\ttm, err := tea.NewProgram(\n\t\tm,\n\t\ttea.WithOutput(os.Stderr),\n\t\ttea.WithContext(ctx),\n\t).Run()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unable to pick selection: %w\", err)\n\t}\n\tm = tm.(model)\n\tif !m.submitted {\n\t\treturn errors.New(\"nothing selected\")\n\t}\n\tif o.Ordered && o.Limit > 1 {\n\t\tsort.Slice(m.items, func(i, j int) bool {\n\t\t\treturn m.items[i].order < m.items[j].order\n\t\t})\n\t}\n\n\tvar out []string\n\tfor _, item := range m.items {\n\t\tif item.selected {\n\t\t\tout = append(out, options[item.text])\n\t\t}\n\t}\n\ttty.Println(strings.Join(out, o.OutputDelimiter))\n\treturn nil\n}\n","sourceCodeStart":140,"sourceCodeEnd":175,"githubUrl":"https://github.com/charmbracelet/gum/blob/4d089f95507708a71f64dacfe7ca513219dd5267/choose/command.go#L140-L175","documentation":"gum choose returns this error when the bubbletea program exits without a submission — the user quit or pressed esc/ctrl-c instead of confirming a selection. The model's `submitted` flag was false at the end of Run.","triggerScenarios":"tea.Program.Run() completes, tm is cast to model, and m.submitted is false — i.e. the user dismissed the picker without choosing (esc, ctrl-c, or q depending on keymap).","commonSituations":"Users pressing Esc/Ctrl-C in interactive scripts; CI or non-TTY environments aborting the TUI; timeouts killing the program.","solutions":["Handle the non-zero exit as 'user cancelled' and branch accordingly in your script","Check for available choices so users can actually select something","Consider whether esc/ctrl-c keys are mapped for submission if headless behavior is needed"],"exampleFix":"// before\nchoice=$(gum choose a b c) || exit 1\n// after\nchoice=$(gum choose a b c) || { echo \"cancelled\"; exit 0; }","handlingStrategy":"try-catch","validationCode":"null","typeGuard":"null","tryCatchPattern":"if ! choice=$(gum choose a b c); then\n  echo 'user cancelled selection'\n  exit 0\nfi\nprintf '%s\\n' \"$choice\"","preventionTips":["Always check gum's exit status rather than assuming a selection","Decide upfront how cancellations should be handled in scripts","In Go, wrap Options.Run() and inspect errors.New(\"nothing selected\") via errors.Is/compare"],"tags":["cli","gum","choose","user-cancelled"],"backgroundTag":"user-aborted-selection","analyzedSha":"4d089f95507708a71f64dacfe7ca513219dd5267","analyzedAt":"2026-08-31T18:45:06.436Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}