junegunn/fzf · error
minimum height must be a non-negative integer
Error message
minimum height must be a non-negative integer
What it means
Thrown when --min-height's numeric part fails atoi or is negative. The option accepts HEIGHT optionally suffixed with '+' (meaning 'auto-grow allowed', internally stored as a negative number); if the remaining expression is not a valid non-negative integer, the error fires. Note percentages are handled elsewhere (parseSize).
Source
Thrown at src/options.go:3219
if err != nil {
return err
}
if opts.Height, err = parseHeight(str, index); err != nil {
return err
}
case "--min-height":
expr, err := nextString("minimum height required: HEIGHT[+]")
if err != nil {
return err
}
auto := false
if strings.HasSuffix(expr, "+") {
expr = expr[:len(expr)-1]
auto = true
}
num, err := atoi(expr)
if err != nil || num < 0 {
return errors.New("minimum height must be a non-negative integer")
}
if auto {
num *= -1
}
opts.MinHeight = num
case "--no-height":
opts.Height = heightSpec{}
case "--no-margin":
opts.Margin = defaultMargin()
case "--no-padding":
opts.Padding = defaultMargin()
case "--no-border":
opts.BorderShape = tui.BorderNone
case "--border":
hasArg, arg := optionalNextString()
if opts.BorderShape, err = parseBorder(arg, !hasArg); err != nil {
return err
}View on GitHub (pinned to bd4efa277b)
Solutions
- Use a plain non-negative integer: `--min-height 10`
- Put the '+' suffix for auto-grow: `--min-height 10+`
- Sanitize computed values to integers (strip decimals, clamp >= 0) before passing
Example fix
# before fzf --min-height +5 # after fzf --min-height 5+
Defensive patterns
Strategy: validation
Validate before calling
# bash: HEIGHT or HEIGHT+ only [[ "$MH" =~ ^[0-9]+\+?$ ]] || MH=10 fzf --min-height "$MH"
Type guard
min_height_ok() { [[ "$1" =~ ^[0-9]+\+?$ ]]; } Prevention
- Remember the '+' is a suffix (10+), not a prefix
- Validate against ^[0-9]+\+?$ before passing user input
When it happens
Trigger: `--min-height abc`, `--min-height -10`, `--min-height 5.5`, or `--min-height +5` (the '+' must be a suffix: '5+', not a prefix).
Common situations: Placing the auto-grow '+' before the number; passing computed values containing spaces or decimals; confusing --min-height semantics with --height's negative/percent forms.
Related errors
- unknown action: ${spec}
- ${label} must be non-negative
- ${label} (without %) must be a non-negative integer
- invalid layout (expected: default / reverse / reverse-list)
- invalid info style (expected: default|right|hidden|inline[-r
AI-assisted analysis of junegunn/fzf@bd4efa277b (2026-08-15).
Data as JSON: /api/errors/173a90888eea3976.
Report an issue: GitHub.