kovidgoyal/kitty · warning

{vals[0]} is not a valid number of prompts to jump for scrol

Error message

{vals[0]} is not a valid number of prompts to jump for scroll_to_prompt

What it means

The first argument to scroll_to_prompt (number of prompts to jump) is not an integer; kitty keeps the default -1 (previous prompt).

Source

Thrown at kitty/options/utils.py:383

        num = int(rest)
    except Exception:
        if rest:
            log_error(f'Invalid number for {func}: {rest}')
        num = 1
    return func, [num]


@func_with_args('scroll_to_prompt')
def scroll_to_prompt(func: str, rest: str) -> FuncArgsType:
    vals = rest.strip().split()
    args = [-1, 0]
    if len(vals) > 2:
        log_error('scroll_to_prompt needs one or two arguments, using defaults')
    else:
        try:
            args[0] = int(vals[0])
        except Exception:
            log_error(f'{vals[0]} is not a valid number of prompts to jump for scroll_to_prompt')
        if len(vals) == 2:
            try:
                args[1] = int(vals[1])
            except Exception:
                log_error(f'{vals[1]} is not a valid scroll offset for scroll_to_prompt')
    return func, args


@func_with_args('sleep')
def sleep(func: str, sleep_time: str) -> FuncArgsType:
    mult = 1
    sleep_time = sleep_time or '1'
    if sleep_time[-1] in 'shmd':
        mult = {'s': 1, 'm': 60, 'h': 3600, 'd': 24 * 3600}[sleep_time[-1]]
        sleep_time = sleep_time[:-1]
    return func, [abs(float(sleep_time)) * mult]

View on GitHub (pinned to 6d5d0c4406)

Solutions

  1. Use integers: negative counts jump backward (e.g. -1 for previous prompt), positive forward
  2. Replace word arguments with their numeric equivalents

Example fix

# before
map f1 scroll_to_prompt prev 0
# after
map f1 scroll_to_prompt -1 0
Defensive patterns

Strategy: validation

Validate before calling

ok = '-1'.lstrip('+-').isdigit()

Prevention

When it happens

Trigger: `map f1 scroll_to_prompt prev 0` — int(vals[0]) raises on 'prev'.

Common situations: Using words like 'prev'/'next' instead of signed integers; negative-one vs the word 'previous' confusion.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


AI-assisted analysis of kovidgoyal/kitty@6d5d0c4406 (2026-08-27). Data as JSON: /api/errors/756f817615994564. Report an issue: GitHub.