kovidgoyal/kitty · warning

Too few arguments to pipe function

Error message

Too few arguments to pipe function

What it means

The pipe action requires at least three shell-split arguments (name, command type/window filter, and the command); with fewer, kitty substitutes the no-op ['none','none','true'].

Source

Thrown at kitty/options/utils.py:333

@func_with_args('move_window')
def move_window(func: str, rest: str) -> FuncArgsType:
    rest = rest.lower()
    rest = {'up': 'top', 'down': 'bottom'}.get(rest, rest)
    prest: int | str = rest
    try:
        prest = int(prest)
    except Exception:
        if prest not in ('left', 'right', 'top', 'bottom'):
            log_error(f'Invalid move_window specification: {rest}')
            prest = 0
    return func, [prest]


@func_with_args('pipe')
def pipe(func: str, rest: str) -> FuncArgsType:
    r = list(shlex_split(rest))
    if len(r) < 3:
        log_error('Too few arguments to pipe function')
        r = ['none', 'none', 'true']
    return func, r


@func_with_args('set_colors')
def set_colors(func: str, rest: str) -> FuncArgsType:
    r = list(shlex_split(rest))
    if len(r) < 1:
        log_error('Too few arguments to set_colors function')
    return func, r


@func_with_args('remote_control')
def remote_control(func: str, rest: str) -> FuncArgsType:
    func, args = shlex_parse(func, rest)
    if len(args) < 1:
        log_error('Too few arguments to remote_control function')
    return func, args

View on GitHub (pinned to 6d5d0c4406)

Solutions

  1. Use full syntax: pipe <name> <text|screen|ansi|...> <command...>, e.g. `map f1 pipe selected text pbcopy`
  2. Check quoting: the command portion with spaces must be one shell-quoted token list that splits to >= 3 fields

Example fix

# before
map f1 pipe pbcopy
# after
map f1 pipe selected text pbcopy
Defensive patterns

Strategy: validation

Validate before calling

import shlex
ok = len(shlex.split('selected text pbcopy')) >= 3

Prevention

When it happens

Trigger: `map f1 pipe some-command` — shlex_split(rest) yields fewer than 3 items.

Common situations: Misremembering pipe's syntax (it needs a name, a filter like 'text'/'screen'/'ansi' plus the command) or unbalanced quotes causing shlex to produce fewer tokens.

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