{"record":{"id":"4c79c2c9ea962199","repo":"junegunn/fzf","slug":"label-without-must-be-a-non-negative-intege","errorCode":null,"errorMessage":"${label} (without %) must be a non-negative integer","messagePattern":"(.+?) \\(without %\\) must be a non-negative integer","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/options.go","lineNumber":2243,"sourceCode":"func parseSize(str string, maxPercent float64, label string) (sizeSpec, error) {\n\tvar spec = sizeSpec{}\n\tvar val float64\n\tvar err error\n\tpercent := strings.HasSuffix(str, \"%\")\n\tif percent {\n\t\tif val, err = atof(str[:len(str)-1]); err != nil {\n\t\t\treturn spec, err\n\t\t}\n\n\t\tif val < 0 {\n\t\t\treturn spec, errors.New(label + \" must be non-negative\")\n\t\t}\n\t\tif val > maxPercent {\n\t\t\treturn spec, fmt.Errorf(\"%s too large (max: %d%%)\", label, int(maxPercent))\n\t\t}\n\t} else {\n\t\tif strings.Contains(str, \".\") {\n\t\t\treturn spec, errors.New(label + \" (without %) must be a non-negative integer\")\n\t\t}\n\n\t\ti, err := atoi(str)\n\t\tif err != nil {\n\t\t\treturn spec, err\n\t\t}\n\t\tval = float64(i)\n\t\tif val < 0 {\n\t\t\treturn spec, errors.New(label + \" must be non-negative\")\n\t\t}\n\t}\n\treturn sizeSpec{val, percent}, nil\n}\n\nfunc parseHeight(str string, index int) (heightSpec, error) {\n\theightSpec := heightSpec{index: index}\n\tif strings.HasPrefix(str, \"~\") {\n\t\theightSpec.auto = true","sourceCodeStart":2225,"sourceCodeEnd":2261,"githubUrl":"https://github.com/junegunn/fzf/blob/bd4efa277b49ef34ca4025bff9b1a288e1980eff/src/options.go#L2225-L2261","documentation":"Thrown by parseSize for non-percent inputs. Without a trailing '%', the value must be a plain non-negative integer (parsed via atoi); a decimal point in the string (e.g. '1.5') is rejected outright with this message before atoi is attempted.","triggerScenarios":"`--height 1.5`, `--min-height 10.25`, `--preview-window right:50.5` — any non-percent size containing a '.'.","commonSituations":"Dividing sizes in shell with bc/awk (which emit decimals) and feeding the result straight to fzf; assuming fractional line counts are allowed because the %-form accepts fractional numbers via atof.","solutions":["Round or truncate computed values to integers: use printf '%.0f' or awk int(...)","Use the '%' form if fractional values are intended, since percent parsing uses atof"],"exampleFix":"# before\nfzf --height \"$(echo \"$LINES*0.4\" | bc -l)\"\n# after\nfzf --height \"$(awk \"BEGIN{printf \\\"%d\\\", $LINES*0.4}\")\"","handlingStrategy":"validation","validationCode":"# bash: non-percent sizes must be plain integers\n[[ \"$SIZE\" =~ ^[0-9]+$ ]] || { echo \"size must be an integer\" >&2; exit 1; }\nfzf --height \"$SIZE\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Round decimal results (awk int(), printf '%.0f') before passing sizes","Use '%' suffix when fractional values are meaningful"],"tags":["fzf","go","cli","size","parsing"],"backgroundTag":null,"analyzedSha":"bd4efa277b49ef34ca4025bff9b1a288e1980eff","analyzedAt":"2026-08-15T06:11:46.983Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}