{"record":{"id":"0ff9cc8f1f0482e7","repo":"charmbracelet/gum","slug":"nothing-selected-0ff9cc","errorCode":null,"errorMessage":"nothing selected","messagePattern":"nothing selected","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"filter/command.go","lineNumber":153,"sourceCode":"\t\t\t}\n\t\t\tif o.Limit == 1 {\n\t\t\t\tm.cursor = i\n\t\t\t\tm.selected[option.Str] = struct{}{}\n\t\t\t} else {\n\t\t\t\tcurrentSelected++\n\t\t\t\tm.selected[option.Str] = struct{}{}\n\t\t\t}\n\t\t}\n\t}\n\n\ttm, err := tea.NewProgram(m, options...).Run()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unable to run filter: %w\", err)\n\t}\n\n\tm = tm.(model)\n\tif !m.submitted {\n\t\treturn errors.New(\"nothing selected\")\n\t}\n\n\t// allSelections contains values only if limit is greater\n\t// than 1 or if flag --no-limit is passed, hence there is\n\t// no need to further checks\n\tif len(m.selected) > 0 {\n\t\to.checkSelected(m)\n\t} else if len(m.matches) > m.cursor && m.cursor >= 0 {\n\t\ttty.Println(m.matches[m.cursor].Str)\n\t}\n\n\treturn nil\n}\n\nfunc (o Options) checkSelected(m model) {\n\tout := make([]string, 0, len(m.selected))\n\tfor k := range m.selected {\n\t\tout = append(out, k)","sourceCodeStart":135,"sourceCodeEnd":171,"githubUrl":"https://github.com/charmbracelet/gum/blob/4d089f95507708a71f64dacfe7ca513219dd5267/filter/command.go#L135-L171","documentation":"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.","triggerScenarios":"After tea.Program.Run() succeeds (filter path), tm cast to model has submitted == false, i.e. no confirmed selection was made.","commonSituations":"Users pressing Esc/Ctrl-C while filtering; non-TTY/CI runs aborting the prompt; timeouts closing the program before the user submits.","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"],"exampleFix":"// before\nsel=$(gum filter a b c) || exit 1\n// after\nsel=$(gum filter a b c) || sel=default","handlingStrategy":"try-catch","validationCode":"null","typeGuard":"null","tryCatchPattern":"if ! sel=$(gum filter a b c); then\n  sel=\"default\"\nfi","preventionTips":["Treat non-zero exit as user cancellation","Raise --timeout for slow decisions","Ensure a proper TTY so the filter prompt renders"],"tags":["cli","gum","filter","user-cancelled"],"backgroundTag":"user-aborted-selection","analyzedSha":"4d089f95507708a71f64dacfe7ca513219dd5267","analyzedAt":"2026-08-31T18:45:06.436Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}