{"record":{"id":"192d3b541744af99","repo":"junegunn/fzf","slug":"at-least-one-of-file-or-dir-should-be-specifie","errorCode":null,"errorMessage":"at least one of 'file' or 'dir' should be specified","messagePattern":"at least one of 'file' or 'dir' should be specified","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/options.go","lineNumber":1649,"sourceCode":"\topts := walkerOpts{}\n\tfor _, str := range strings.Split(strings.ToLower(str), \",\") {\n\t\tswitch str {\n\t\tcase \"file\":\n\t\t\topts.file = true\n\t\tcase \"dir\":\n\t\t\topts.dir = true\n\t\tcase \"hidden\":\n\t\t\topts.hidden = true\n\t\tcase \"follow\":\n\t\t\topts.follow = true\n\t\tcase \"\":\n\t\t\t// Ignored\n\t\tdefault:\n\t\t\treturn opts, errors.New(\"invalid walker option: \" + str)\n\t\t}\n\t}\n\tif !opts.file && !opts.dir {\n\t\treturn opts, errors.New(\"at least one of 'file' or 'dir' should be specified\")\n\t}\n\treturn opts, nil\n}\n\nvar (\n\targActionRegexp  *regexp.Regexp\n\tsplitRegexp      *regexp.Regexp\n\tactionNameRegexp *regexp.Regexp\n)\n\nfunc firstKey(keymap map[tui.Event]string) tui.Event {\n\tfor k := range keymap {\n\t\treturn k\n\t}\n\treturn tui.EventType(0).AsEvent()\n}\n\nconst (","sourceCodeStart":1631,"sourceCodeEnd":1667,"githubUrl":"https://github.com/junegunn/fzf/blob/bd4efa277b49ef34ca4025bff9b1a288e1980eff/src/options.go#L1631-L1667","documentation":"Thrown while parsing the --walker option. The walker option list must explicitly include 'file' and/or 'dir' to tell fzf which entry types to emit; every other token (hidden, follow, or skip patterns) only refines the traversal. If neither 'file' nor 'dir' appears, the parsed walkerOpts has both flags false and options parsing aborts.","triggerScenarios":"Passing --walker with only modifier tokens, e.g. `--walker hidden`, `--walker follow`, `--walker skip:node_modules`, or `--walker hidden,follow` — none of which contains 'file' or 'dir'.","commonSituations":"A developer adds --walker hidden expecting 'hidden files in addition to defaults', not knowing that file/dir selection is opt-in and not defaulted; or a typo like 'files' or 'dirs' (plural) silently falls through to the invalid-walker-option/default path.","solutions":["Include 'file' or 'dir' explicitly: `--walker file,dir,hidden,follow`","Check spelling of every token: singular 'file'/'dir', not 'files'/'dirs'","Remove --walker entirely if the default file+dir walking is acceptable"],"exampleFix":"# before\nfzf --walker hidden\n# after\nfzf --walker file,dir,hidden","handlingStrategy":"validation","validationCode":"# bash: require file or dir token in --walker\nwalker_ok() {\n  case \",$1,\" in\n    *,file,*|*,dir,*) return 0;;\n    *) echo \"--walker needs 'file' or 'dir'\" >&2; return 1;;\n  esac\n}\nwalker_ok \"$WALKER\" && fzf --walker \"$WALKER\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always write --walker specs starting from file,dir then add modifiers","Validate generated option strings in CI by running `fzf <opts> </dev/null` and checking the exit status"],"tags":["fzf","go","cli","options","walker"],"backgroundTag":null,"analyzedSha":"bd4efa277b49ef34ca4025bff9b1a288e1980eff","analyzedAt":"2026-08-15T06:11:46.983Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}