junegunn/fzf · error

every() interval is too large

Error message

every() interval is too large

What it means

parseEveryEvent converts the interval to milliseconds and stores it in an int32 field of the Event struct. If seconds*1000 exceeds math.MaxInt32 (≈2147483 seconds ≈ 24.8 days), the value cannot be represented and this error is returned.

Source

Thrown at src/options.go:1331

			} else {
				return nil, list, errors.New("unsupported key: " + key)
			}
		}
	}
	return chords, list, nil
}

func parseEveryEvent(arg string) (tui.Event, error) {
	secs, err := strconv.ParseFloat(strings.TrimSpace(arg), 64)
	if err != nil || math.IsNaN(secs) || math.IsInf(secs, 0) || secs <= 0 {
		return tui.Event{}, errors.New("every() requires a positive number of seconds")
	}
	if secs < 0.01 {
		secs = 0.01
	}
	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) {

View on GitHub (pinned to bd4efa277b)

Solutions

  1. Keep the interval under 2147483.647 seconds (~24.8 days) — in practice use minutes/hours at most
  2. Fix unit confusion: the argument is seconds, not milliseconds
  3. Check for extra digits / pasted large constants in generated --bind strings

Example fix

# before
fzf --bind 'every-86400000:reload(...)'
# after
fzf --bind 'every-86400:reload(...)'
Defensive patterns

Strategy: validation

Validate before calling

INTERVAL="${INTERVAL:-5}"
awk -v i="$INTERVAL" 'BEGIN { if (i+0 > 2147483.647) exit 1 }' && fzf --bind "every-${INTERVAL}s:reload(...)" || { echo 'interval too large (max ~24.8 days)' >&2; exit 1; }

Prevention

When it happens

Trigger: every(99999999) or any interval over ~24.8 days; also large-but-finite values like 1e9 seconds; Infinity is already caught by the earlier NaN/Inf guard, so only finite huge numbers reach this check.

Common situations: Typing an extra digit (every-864000s); unit confusion (passing milliseconds where seconds are expected, e.g. every(86400000)); scripts computing intervals from ms timestamps.

Related errors


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