charmbracelet/gum · error
nothing selected
Error message
nothing selected
What it means
gum filter returns this when the bubbletea filter program exits with m.submitted == false — the user quit without confirming a selection (esc/ctrl-c). Like gum choose, Run treats this as an error rather than returning an empty result.
Source
Thrown at filter/command.go:153
}
if o.Limit == 1 {
m.cursor = i
m.selected[option.Str] = struct{}{}
} else {
currentSelected++
m.selected[option.Str] = struct{}{}
}
}
}
tm, err := tea.NewProgram(m, options...).Run()
if err != nil {
return fmt.Errorf("unable to run filter: %w", err)
}
m = tm.(model)
if !m.submitted {
return errors.New("nothing selected")
}
// allSelections contains values only if limit is greater
// than 1 or if flag --no-limit is passed, hence there is
// no need to further checks
if len(m.selected) > 0 {
o.checkSelected(m)
} else if len(m.matches) > m.cursor && m.cursor >= 0 {
tty.Println(m.matches[m.cursor].Str)
}
return nil
}
func (o Options) checkSelected(m model) {
out := make([]string, 0, len(m.selected))
for k := range m.selected {
out = append(out, k)View on GitHub (pinned to 4d089f9550)
Solutions
- Handle non-zero exit as cancellation in your script
- Give users enough time (raise --timeout) and a working TTY environment
- Provide a default/fallback value when no selection is made
Example fix
// before sel=$(gum filter a b c) || exit 1 // after sel=$(gum filter a b c) || sel=default
Defensive patterns
Strategy: try-catch
Validate before calling
null
Type guard
null
Try / catch
if ! sel=$(gum filter a b c); then sel="default" fi
Prevention
- Treat non-zero exit as user cancellation
- Raise --timeout for slow decisions
- Ensure a proper TTY so the filter prompt renders
When it happens
Trigger: After tea.Program.Run() succeeds (filter path), tm cast to model has submitted == false, i.e. no confirmed selection was made.
Common situations: Users pressing Esc/Ctrl-C while filtering; non-TTY/CI runs aborting the prompt; timeouts closing the program before the user submits.
Related errors
- nothing selected
- no file selected
- no options provided, see `gum filter --help`
- no options provided, see `gum choose --help`
- invalid option format: %q
AI-assisted analysis of charmbracelet/gum@4d089f9550 (2026-08-31).
Data as JSON: /api/errors/0ff9cc8f1f0482e7.
Report an issue: GitHub.