kovidgoyal/kitty · warning

resize_window needs one or two arguments, using defaults

Error message

resize_window needs one or two arguments, using defaults

What it means

The resize_window action got more than two arguments; kitty discards them and uses defaults ['wider', 1].

Source

Thrown at kitty/options/utils.py:298

        log_error('Ignoring invalid paste string: ' + rest)
    return func, [text]


@func_with_args('neighboring_window')
def neighboring_window(func: str, rest: str) -> FuncArgsType:
    rest = rest.lower()
    rest = {'up': 'top', 'down': 'bottom'}.get(rest, rest)
    if rest not in ('left', 'right', 'top', 'bottom'):
        log_error(f'Invalid neighbor specification: {rest}')
        rest = 'right'
    return func, [rest]


@func_with_args('resize_window')
def resize_window(func: str, rest: str) -> FuncArgsType:
    vals = rest.strip().split(maxsplit=1)
    if len(vals) > 2:
        log_error('resize_window needs one or two arguments, using defaults')
        args = ['wider', 1]
    else:
        quality = vals[0].lower()
        if quality not in ('reset', 'taller', 'shorter', 'wider', 'narrower'):
            log_error(f'Invalid quality specification: {quality}')
            quality = 'wider'
        increment = 1
        if len(vals) == 2:
            try:
                increment = int(vals[1])
            except Exception:
                log_error(f'Invalid increment specification: {vals[1]}')
        args = [quality, increment]
    return func, args


@func_with_args('move_window')
def move_window(func: str, rest: str) -> FuncArgsType:

View on GitHub (pinned to 6d5d0c4406)

Solutions

  1. Use at most two arguments: resize_window <reset|taller|shorter|wider|narrower> [increment]
  2. Remove any extra tokens after the increment

Example fix

# before
map f1 resize_window taller 2 cells
# after
map f1 resize_window taller 2
Defensive patterns

Strategy: validation

Validate before calling

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

Prevention

When it happens

Trigger: `map f1 resize_window taller 2 extra` — rest.strip().split(maxsplit=1) still leaves extra tokens, i.e. len(vals) > 2 is detected when more than two whitespace-separated tokens are present.

Common situations: Copy-paste errors or misunderstanding the syntax and adding unit suffixes like `resize_window taller 2 px`.

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