{"record":{"id":"1ce3fcf9f55db500","repo":"kovidgoyal/kitty","slug":"invalid-encoding-for-send-text-data-encoding","errorCode":null,"errorMessage":"Invalid encoding for send-text data: {encoding}","messagePattern":"Invalid encoding for send-text data: (.+?)","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"kitty/rc/send_text.py","lineNumber":222,"sourceCode":"        sid = payload_get('session_id', '')\n        windows = self.windows_for_payload(boss, window, payload_get, window_match_name='match')\n        pdata: str = payload_get('data')\n        encoding, _, q = pdata.partition(':')\n        session = ''\n        if encoding == 'text':\n            data: bytes | WindowSystemKeyEvent = q.encode('utf-8')\n        elif encoding == 'base64':\n            data = base64.standard_b64decode(q)\n        elif encoding == 'kitty-key':\n            bdata = base64.standard_b64decode(q)\n            candidate = decode_key_event_as_window_system_key(bdata.decode('ascii'))\n            if candidate is None:\n                raise ValueError(f'Could not decode window system key: {q}')\n            data = candidate\n        elif encoding == 'session':\n            session = q\n        else:\n            raise TypeError(f'Invalid encoding for send-text data: {encoding}')\n        exclude_active = payload_get('exclude_active')\n        actual_windows = (w for w in windows if w is not None and (not exclude_active or w is not boss.active_window))\n\n        def create_or_update_session() -> Session:\n            s = sessions_map.setdefault(sid, Session(sid))\n            return s\n\n        if session == 'end':\n            s = create_or_update_session()\n            for w in actual_windows:\n                w.screen.render_unfocused_cursor = False\n                s.window_ids.discard(w.id)\n            ClearSession(sid)()\n        elif session == 'start':\n            s = create_or_update_session()\n            if window is not None:\n\n                def is_ok(x: Any) -> bool:","sourceCodeStart":204,"sourceCodeEnd":240,"githubUrl":"https://github.com/kovidgoyal/kitty/blob/6d5d0c440603ad9bdf6dcd599f73f6dde21acb44/kitty/rc/send_text.py#L204-L240","documentation":"send-text validates the --encoding argument against the allowed set (text/base64/kitty-key/session); anything else raises TypeError.","triggerScenarios":"Passing an encoding string other than 'text', 'base64', 'kitty-key', or 'session' to the send-text remote command payload.","commonSituations":"Typos in encoding names, or scripts written against an older/newer kitty where the encoding set differs.","solutions":["Use one of the supported encodings: text, base64, kitty-key, or session","Check kitty version documentation for the current encoding list"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":"ENCODINGS = {'text','base64','kitty-key','session'}\nassert encoding in ENCODINGS, f'unsupported encoding: {encoding}'","typeGuard":"def is_valid_encoding(e: str) -> bool: return e in {'text','base64','kitty-key','session'}","tryCatchPattern":null,"preventionTips":["Pin encodings from --help output of your kitty version"],"tags":["kitty","send-text","validation"],"backgroundTag":"invalid-enum-value","analyzedSha":"6d5d0c440603ad9bdf6dcd599f73f6dde21acb44","analyzedAt":"2026-08-27T14:20:20.142Z","schemaVersion":2},"datasetVersion":"2026-08-27T19:17:21.184Z"}