junegunn/fzf · error

invalid scoring scheme: ${str} (expected: default|path|histo

Error message

invalid scoring scheme: ${str} (expected: default|path|history)

What it means

parseScheme maps the --scheme flag (fzf 0.48+, deprecating --algo-specific ranking) to a ranking strategy: 'history' ranks by score alone, 'path' adds pathname/length awareness, 'default' is score+length. Any other lowercase token is rejected with the accepted list.

Source

Thrown at src/options.go:1346

	}
	ms := math.Round(secs * 1000)
	if ms > math.MaxInt32 {
		return tui.Event{}, errors.New("every() interval is too large")
	}
	return tui.Event{Type: tui.Every, Char: rune(int32(ms))}, nil
}

func parseScheme(str string) (string, []criterion, error) {
	str = strings.ToLower(str)
	switch str {
	case "history":
		return str, []criterion{byScore}, nil
	case "path":
		return str, []criterion{byScore, byPathname, byLength}, nil
	case "default":
		return str, []criterion{byScore, byLength}, nil
	}
	return str, nil, errors.New("invalid scoring scheme: " + str + " (expected: default|path|history)")
}

func parseTiebreak(str string) ([]criterion, error) {
	criteria := []criterion{byScore}
	hasIndex := false
	hasChunk := false
	hasLength := false
	hasBegin := false
	hasEnd := false
	hasPathname := false
	check := func(notExpected *bool, name string) error {
		if *notExpected {
			return errors.New("duplicate sort criteria: " + name)
		}
		if hasIndex {
			return errors.New("index should be the last criterion")
		}
		*notExpected = true

View on GitHub (pinned to bd4efa277b)

Solutions

  1. Use one of default|path|history: fzf --scheme path
  2. Omit --scheme to get 'default' behavior
  3. Default unset shell variables: --scheme "${SCHEME:-default}"
  4. For historical ranking via $FZF_HISTORY_FILE just use --scheme history

Example fix

# before
fzf --scheme=fuzzy
# after
fzf --scheme=default
Defensive patterns

Strategy: type-guard

Validate before calling

SCHEME="${SCHEME:-default}"
case "${SCHEME,,}" in default|path|history) ;; *) echo "invalid scheme: $SCHEME" >&2; exit 1;; esac
fzf --scheme "$SCHEME"

Type guard

isValidFzfScheme() { case "$1" in default|path|history) return 0;; *) return 1;; esac; }

Prevention

When it happens

Trigger: --scheme fuzzy, --scheme=path (not in the list), --scheme History (lowercased before the switch, so this actually works — but '--scheme default2' fails), or an unset variable producing '--scheme ' with an empty value.

Common situations: Dotfiles from skim or other clones using scheme names like 'path_history'; users assuming --scheme mirrors --algo values; empty expansion of $FZF_SCHEME in exported FZF_DEFAULT_OPTS.

Related errors


AI-assisted analysis of junegunn/fzf@bd4efa277b (2026-08-15). Data as JSON: /api/errors/dcae4f0e103e7d6b. Report an issue: GitHub.