junegunn/fzf · error
invalid wrap mode: %s (expected: char or word)
Error message
invalid wrap mode: %s (expected: char or word)
What it means
Thrown when --wrap is given an explicit argument that is not 'char' or 'word'. --wrap alone enables character wrapping; --wrap word enables word wrapping; any other string (including empty or misspelled values) is rejected. Note --wrap-word exists as a separate option.
Source
Thrown at src/options.go:2947
opts.Cycle = true
case "--highlight-line":
opts.CursorLine = true
case "--no-highlight-line":
opts.CursorLine = false
case "--no-cycle":
opts.Cycle = false
case "--wrap":
given, str := optionalNextString()
if given {
switch str {
case "char":
opts.Wrap = true
opts.WrapWord = false
case "word":
opts.Wrap = true
opts.WrapWord = true
default:
return errors.New("invalid wrap mode: " + str + " (expected: char or word)")
}
} else {
opts.Wrap = true
}
case "--no-wrap":
opts.Wrap = false
opts.WrapWord = false
case "--wrap-word":
opts.Wrap = true
opts.WrapWord = true
case "--no-wrap-word":
opts.WrapWord = false
case "--wrap-sign":
str, err := nextString("wrap sign required")
if err != nil {
return err
}
opts.WrapSign = &strView on GitHub (pinned to bd4efa277b)
Solutions
- Use `--wrap` alone, `--wrap char`, `--wrap word`, or `--wrap-word`
- Check the variable feeding --wrap: must be unset/empty-free and exactly 'char' or 'word'
- Upgrade fzf if --wrap is not recognized at all (added in 0.48+)
Example fix
# before fzf --wrap line # after fzf --wrap word
Defensive patterns
Strategy: type-guard
Validate before calling
# bash [[ "$WRAP" =~ ^(char|word)$ ]] || WRAP="" [ -n "$WRAP" ] && fzf --wrap "$WRAP" || fzf --wrap
Type guard
wrap_mode_ok() { case "$1" in char|word) return 0;; *) return 1;; esac; } Prevention
- Whitelist wrap mode values to char|word before forwarding
- Use --wrap-word directly for word mode instead of --wrap word
When it happens
Trigger: `--wrap line`, `--wrap chars` (plural), `--wrap ''` via an optional-argument quirk, or a variable expanding to something unexpected.
Common situations: Assuming 'line' or 'lines' is valid vocabulary; scripts passing WRAP_MODE variables that are empty or mis-set; fzf versions where --wrap itself is unavailable (then the option is unknown outright).
Related errors
- invalid info style (expected: default|right|hidden|inline[-r
- list border cannot be 'line'
- unknown action: ${spec}
- invalid layout (expected: default / reverse / reverse-list)
- history max must be a positive integer
AI-assisted analysis of junegunn/fzf@bd4efa277b (2026-08-15).
Data as JSON: /api/errors/85fb2e30871dbdcf.
Report an issue: GitHub.