kovidgoyal/kitty · warning

scroll_to_prompt needs one or two arguments, using defaults

Error message

scroll_to_prompt needs one or two arguments, using defaults

What it means

scroll_to_prompt accepts at most two arguments (prompt count and scroll offset); more than that triggers this message and kitty keeps the defaults [-1, 0].

Source

Thrown at kitty/options/utils.py:378


@func_with_args('nth_os_window', 'nth_window', 'visual_window_select_action_trigger', 'next_layout')
def single_integer_arg(func: str, rest: str) -> FuncArgsType:
    try:
        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':

View on GitHub (pinned to 6d5d0c4406)

Solutions

  1. Use at most two integer arguments: scroll_to_prompt [prompt_count] [scroll_offset]
  2. Move any trailing text off the map line

Example fix

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

Strategy: validation

Validate before calling

tokens = '-1 0'.split()
ok = len(tokens) <= 2

Prevention

When it happens

Trigger: `map f1 scroll_to_prompt -1 0 extra` — rest.strip().split() yields more than 2 tokens.

Common situations: Adding extra parameters or comments on the same map line; misunderstanding the action's arity.

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/0cd2eea8294348ea. Report an issue: GitHub.