{"record":{"id":"b111b1baa2959d3f","repo":"charmbracelet/gum","slug":"no-options-provided-see-gum-filter-help","errorCode":null,"errorMessage":"no options provided, see `gum filter --help`","messagePattern":"no options provided, see `gum filter --help`","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"filter/command.go","lineNumber":50,"sourceCode":"\tstyles.Blurred.Prompt = o.PromptStyle.ToLipgloss()\n\tstyles.Focused.Placeholder = o.PlaceholderStyle.ToLipgloss()\n\tstyles.Blurred.Placeholder = o.PlaceholderStyle.ToLipgloss()\n\ti.SetStyles(styles)\n\ti.Placeholder = o.Placeholder\n\ti.SetWidth(o.Width)\n\n\tv := viewport.New(viewport.WithWidth(o.Width), viewport.WithHeight(o.Height))\n\n\tif len(o.Options) == 0 {\n\t\tif input, _ := stdin.Read(stdin.StripANSI(o.StripANSI)); input != \"\" {\n\t\t\to.Options = strings.Split(input, o.InputDelimiter)\n\t\t} else {\n\t\t\to.Options = files.List()\n\t\t}\n\t}\n\n\tif len(o.Options) == 0 {\n\t\treturn errors.New(\"no options provided, see `gum filter --help`\")\n\t}\n\n\tctx, cancel := timeout.Context(o.Timeout)\n\tdefer cancel()\n\n\toptions := []tea.ProgramOption{\n\t\ttea.WithOutput(os.Stderr),\n\t\ttea.WithContext(ctx),\n\t}\n\n\tvar matches []fuzzy.Match\n\tif o.Value != \"\" {\n\t\ti.SetValue(o.Value)\n\t}\n\n\tchoices := map[string]string{}\n\tfilteringChoices := []string{}\n\tfor _, opt := range o.Options {","sourceCodeStart":32,"sourceCodeEnd":68,"githubUrl":"https://github.com/charmbracelet/gum/blob/4d089f95507708a71f64dacfe7ca513219dd5267/filter/command.go#L32-L68","documentation":"gum filter sources its candidate list from flags/args, stdin, or (with --fuzzy over the filesystem) files.List(). If all sources yield an empty list, Run fails fast with this pointer to `gum filter --help` rather than showing an empty filter prompt.","triggerScenarios":"Options.Run() reaches `len(o.Options) == 0` — no options passed, empty stdin, and no filesystem fallback produced entries (e.g. empty directory).","commonSituations":"Piping output of a command that matched nothing (`grep foo file | gum filter` with no matches); running gum filter in an empty directory relying on file listing; quoting errors swallowing arguments.","solutions":["Pipe non-empty input or pass options as arguments: gum filter a b c","Verify the upstream pipeline emits data before gum filter consumes it","If relying on file listing, run in a non-empty directory or pass --all/--hidden as appropriate"],"exampleFix":"// before\ngrep 'nomatch' file.txt | gum filter  # no options provided\n// after\ngrep 'nomatch' file.txt | gum filter || echo 'no candidates'","handlingStrategy":"validation","validationCode":"candidates=$(grep pattern file.txt)\n[ -n \"$candidates\" ] && printf '%s\\n' \"$candidates\" | gum filter || echo 'no candidates to filter'","typeGuard":"null","tryCatchPattern":null,"preventionTips":["Verify upstream command output is non-empty before piping","Pass explicit options when the list may be empty","Check the working directory has files when relying on file listing"],"tags":["cli","gum","filter","empty-input"],"backgroundTag":"empty-input-no-options","analyzedSha":"4d089f95507708a71f64dacfe7ca513219dd5267","analyzedAt":"2026-08-31T18:45:06.436Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}