kovidgoyal/kitty · warning

Ignoring invalid paste string:

Error message

Ignoring invalid paste string: 

What it means

The paste action's argument string could not be parsed as ANSI-C escapes (defines.expand_ansi_c_escapes raised). kitty logs and substitutes an empty string, so the paste inserts nothing.

Source

Thrown at kitty/options/utils.py:280


@func_with_args('copy_to_buffer')
def copy_to_buffer(func: str, rest: str) -> FuncArgsType:
    return func, [rest]


@func_with_args('paste_from_buffer')
def paste_from_buffer(func: str, rest: str) -> FuncArgsType:
    return func, [rest]


@func_with_args('paste')
def paste_parse(func: str, rest: str) -> FuncArgsType:
    text = ''
    try:
        text = defines.expand_ansi_c_escapes(rest)
    except Exception:
        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')

View on GitHub (pinned to 6d5d0c4406)

Solutions

  1. Use valid ANSI-C escapes: \e for escape, \n for newline, \xNN hex codes
  2. Quote the string appropriately in kitty.conf so backslashes survive to the parser

Example fix

# before
map f1 paste \control
# after
map f1 paste \e[A
Defensive patterns

Strategy: validation

Validate before calling

from kitty.fast_data_types import expand_ansi_c_escapes  # or replicate
try:
    expand_ansi_c_escapes(r'\e[A'); ok = True
except Exception:
    ok = False

Prevention

When it happens

Trigger: `map f1 paste \q` or any malformed escape sequence like an unterminated/unknown \-escape in the paste argument.

Common situations: Trying to paste special characters with backslash escapes without using valid C-style escapes (\n, \t, \e, \xNN, etc.), or shell-level escaping accidentally corrupting the config string.

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