{"record":{"id":"3d89f6843de89a01","repo":"kovidgoyal/kitty","slug":"ignoring-invalid-paste-string","errorCode":null,"errorMessage":"Ignoring invalid paste string: ","messagePattern":"Ignoring invalid paste string: ","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"kitty/options/utils.py","lineNumber":280,"sourceCode":"\n\n@func_with_args('copy_to_buffer')\ndef copy_to_buffer(func: str, rest: str) -> FuncArgsType:\n    return func, [rest]\n\n\n@func_with_args('paste_from_buffer')\ndef paste_from_buffer(func: str, rest: str) -> FuncArgsType:\n    return func, [rest]\n\n\n@func_with_args('paste')\ndef paste_parse(func: str, rest: str) -> FuncArgsType:\n    text = ''\n    try:\n        text = defines.expand_ansi_c_escapes(rest)\n    except Exception:\n        log_error('Ignoring invalid paste string: ' + rest)\n    return func, [text]\n\n\n@func_with_args('neighboring_window')\ndef neighboring_window(func: str, rest: str) -> FuncArgsType:\n    rest = rest.lower()\n    rest = {'up': 'top', 'down': 'bottom'}.get(rest, rest)\n    if rest not in ('left', 'right', 'top', 'bottom'):\n        log_error(f'Invalid neighbor specification: {rest}')\n        rest = 'right'\n    return func, [rest]\n\n\n@func_with_args('resize_window')\ndef resize_window(func: str, rest: str) -> FuncArgsType:\n    vals = rest.strip().split(maxsplit=1)\n    if len(vals) > 2:\n        log_error('resize_window needs one or two arguments, using defaults')","sourceCodeStart":262,"sourceCodeEnd":298,"githubUrl":"https://github.com/kovidgoyal/kitty/blob/6d5d0c440603ad9bdf6dcd599f73f6dde21acb44/kitty/options/utils.py#L262-L298","documentation":"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.","triggerScenarios":"`map f1 paste \\q` or any malformed escape sequence like an unterminated/unknown \\-escape in the paste argument.","commonSituations":"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.","solutions":["Use valid ANSI-C escapes: \\e for escape, \\n for newline, \\xNN hex codes","Quote the string appropriately in kitty.conf so backslashes survive to the parser"],"exampleFix":"# before\nmap f1 paste \\control\n# after\nmap f1 paste \\e[A","handlingStrategy":"validation","validationCode":"from kitty.fast_data_types import expand_ansi_c_escapes  # or replicate\ntry:\n    expand_ansi_c_escapes(r'\\e[A'); ok = True\nexcept Exception:\n    ok = False","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use only documented C escapes (\\\\, \\n, \\t, \\e, \\xNN, \\NNN octal)","Test paste strings in isolation before adding them to kitty.conf"],"tags":["kitty","config","paste","escapes","parser"],"backgroundTag":"invalid-config-value","analyzedSha":"6d5d0c440603ad9bdf6dcd599f73f6dde21acb44","analyzedAt":"2026-08-27T14:20:20.142Z","schemaVersion":2},"datasetVersion":"2026-08-27T19:17:21.184Z"}