kovidgoyal/kitty · warning

{vals[1]} is not a valid scroll offset for scroll_to_prompt

Error message

{vals[1]} is not a valid scroll offset for scroll_to_prompt

What it means

The second argument to scroll_to_prompt (the scroll offset) is not an integer; kitty keeps the default 0 offset.

Source

Thrown at kitty/options/utils.py:388

    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]


@func_with_args('disable_ligatures_in')
def disable_ligatures_in(func: str, rest: str) -> FuncArgsType:
    parts = rest.split(maxsplit=1)
    if len(parts) == 1:
        where, strategy = 'active', parts[0]

View on GitHub (pinned to 6d5d0c4406)

Solutions

  1. Use an integer line offset, e.g. `map f1 scroll_to_prompt -1 10` to land 10 lines above the prompt
  2. Drop the second argument entirely if no offset is needed

Example fix

# before
map f1 scroll_to_prompt -1 top
# after
map f1 scroll_to_prompt -1 10
Defensive patterns

Strategy: validation

Validate before calling

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

Prevention

When it happens

Trigger: `map f1 scroll_to_prompt -1 top` — int(vals[1]) raises on 'top'.

Common situations: Using words like 'top'/'bottom' for the offset instead of a line count.

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/3fde4471d5d56039. Report an issue: GitHub.