{"record":{"id":"edc6022fa038650a","repo":"junegunn/fzf","slug":"unexpected-value-for-s-s","errorCode":null,"errorMessage":"unexpected value for %s: %s","messagePattern":"unexpected value for (.+?): (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/options.go","lineNumber":3503,"sourceCode":"\t\t\t} else if match, value := optString(arg, \"-d\"); match {\n\t\t\t\topts.Delimiter = delimiterRegexp(value)\n\t\t\t} else if match, value := optString(arg, \"-n\"); match {\n\t\t\t\tif opts.Nth, err = splitNth(value); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t} else if match, _ := optString(arg, \"-s\"); match {\n\t\t\t\topts.Sort = 1 // Don't care\n\t\t\t} else if match, value := optString(arg, \"-m\"); match {\n\t\t\t\tif opts.Multi, err = atoi(value); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\treturn errors.New(\"unknown option: \" + arg)\n\t\t\t}\n\t\t}\n\n\t\tif val != nil {\n\t\t\treturn errors.New(\"unexpected value for \" + arg + \": \" + *val)\n\t\t}\n\t}\n\t*index += len(allArgs)\n\n\tif opts.HeaderLines < 0 {\n\t\treturn errors.New(\"header lines must be a non-negative integer\")\n\t}\n\n\tif opts.HscrollOff < 0 {\n\t\treturn errors.New(\"hscroll offset must be a non-negative integer\")\n\t}\n\n\tif opts.ScrollOff < 0 {\n\t\treturn errors.New(\"scroll offset must be a non-negative integer\")\n\t}\n\n\tif opts.Tabstop < 1 {\n\t\treturn errors.New(\"tab stop must be a positive integer\")","sourceCodeStart":3485,"sourceCodeEnd":3521,"githubUrl":"https://github.com/junegunn/fzf/blob/bd4efa277b49ef34ca4025bff9b1a288e1980eff/src/options.go#L3485-L3521","documentation":"A standalone (no-value) option was given a value. During parsing, certain options are recognized as flags with no argument; if the parser then finds a leftover attached value, it raises 'unexpected value for <arg>: <value>'.","triggerScenarios":"Writing something like -s 1 or --sync=true where the option takes no value: after the option is consumed, the leftover value (val != nil) triggers errors.New(\"unexpected value for \" + arg + \": \" + *val) at options.go:3503. Also triggered by '--flag=value' syntax for boolean-style flags in this branch.","commonSituations":"Applying '=value' syntax to flags that accept no value; copy-pasting option lines from other tools; assuming all long options take arguments.","solutions":["Remove the value: use the flag alone (e.g. -s not -s 1)","For boolean-style long options, drop the '=...' suffix","Check fzf --help to see which options take a value"],"exampleFix":"# before\nfzf -s 1\n# after\nfzf -s","handlingStrategy":"validation","validationCode":"// Shell: strip '=...' from valueless flags\nvalueless='-s --sync --no-sort --reverse +s +i +x'\nargs=()\nfor a in \"$@\"; do\n  k=\"${a%%=*}\"\n  [[ $valueless == *\"$k\"* && \"$a\" == *=* ]] && a=\"$k\"\n  args+=(\"$a\")\ndone\nexec fzf \"${args[@]}\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Learn which fzf flags are valueless (-s, +s, --sync) and never attach values","Keep a list of boolean flags in your wrapper and normalize '=true' suffixes","Read errors as 'unexpected value for X' meaning X takes no argument"],"tags":["fzf","cli","option-parsing"],"backgroundTag":null,"analyzedSha":"bd4efa277b49ef34ca4025bff9b1a288e1980eff","analyzedAt":"2026-08-15T06:11:46.983Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}