kovidgoyal/kitty · error · ValueError

Invalid paste actions

Error message

Invalid paste actions: {q - s}, ignoring

What it means

kitty validates paste_actions as a comma-separated subset of a fixed frozenset of allowed action names; unknown tokens cause this ValueError listing the invalid ones.

Solutions

  1. Correct the action name to one of the allowed values
  2. Check the allowed list in the error/kitty docs for your kitty version
  3. Split multiple actions with commas and no invalid extras

Example fix

# before
paste_actions confirm, sanitize
# after
paste_actions confirm, filter
Defensive patterns

Strategy: type-guard

Validate before calling

ALLOWED = {'quote-urls-at-prompt','confirm','filter','confirm-if-large','replace-dangerous-control-codes','replace-newline','no-op'}
def valid_paste_actions(v: str) -> bool:
    return set(map(str.lower, v.split(','))) <= ALLOWED

Type guard

def is_valid_paste_actions(v: str) -> bool:
    ALLOWED = {'quote-urls-at-prompt','confirm','filter','confirm-if-large','replace-dangerous-control-codes','replace-newline','no-op'}
    return bool(v) and set(map(str.lower, v.split(','))) <= ALLOWED

Prevention

When it happens

Trigger: Setting paste_actions to include tokens not in {'quote-urls-at-prompt','confirm','filter','confirm-if-large','replace-dangerous-control-codes','replace-newline','no-op'}, e.g. 'confirm, sanitize' or a misspelled name.

Common situations: Misspelling an action, using an action removed/renamed between kitty versions, or adding spaces/extra tokens.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


AI-assisted analysis of kovidgoyal/kitty@6d5d0c4406 (2026-08-27). Data as JSON: /api/errors/59c1c52622f1b007. Report an issue: GitHub.

Appendix: source

Thrown at kitty/options/utils.py:1202

def underline_exclusion(x: str) -> tuple[float, Literal['', 'px', 'pt']]:
    try:
        return float(x), ''
    except Exception:
        unit: Literal['pt', 'px'] = x[-2:]  # type: ignore
        if unit not in ('px', 'pt'):
            raise ValueError(f'Invalid underline_exclusion with unrecognized unit: {x}')
        try:
            val = float(x[:-2])
        except Exception:
            raise ValueError(f'Invalid underline_exclusion with non numeric value: {x}')
        return val, unit


def paste_actions(x: str) -> frozenset[str]:
    s = frozenset({'quote-urls-at-prompt', 'confirm', 'filter', 'confirm-if-large', 'replace-dangerous-control-codes', 'replace-newline', 'no-op'})
    q = frozenset(x.lower().split(','))
    if not q.issubset(s):
        raise ValueError(f'Invalid paste actions: {q - s}, ignoring')
    return q


def action_alias(val: str) -> Iterable[tuple[str, str]]:
    parts = val.split(maxsplit=1)
    if len(parts) > 1:
        alias_name, rest = parts
        yield alias_name, rest


kitten_alias = action_alias


def symbol_map_parser(val: str, min_size: int = 2) -> Iterable[tuple[tuple[int, int], str]]:
    parts = val.split()

    if len(parts) < min_size:
        raise ValueError('must have codepoints AND font name')

View on GitHub (pinned to 6d5d0c4406)