{"record":{"id":"4104d8cd514448de","repo":"kovidgoyal/kitty","slug":"unknown-keys-in-multicell-command","errorCode":null,"errorMessage":"Unknown keys in multicell_command: ","messagePattern":"Unknown keys in multicell_command: ","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"kitty/client.py","lineNumber":322,"sourceCode":"\ndef multicell_command(payload: str) -> None:\n    c = json.loads(payload)\n    text = c.pop('', '')\n    m = ''\n    if (w := c.pop('width', None)) is not None and w > 0:\n        m += f'w={w}:'\n    if (s := c.pop('scale', None)) is not None and s > 1:\n        m += f's={s}:'\n    if (n := c.pop('subscale_n', None)) is not None and n > 0:\n        m += f'n={n}:'\n    if (d := c.pop('subscale_d', None)) is not None and d > 0:\n        m += f'd={d}:'\n    if (v := c.pop('vertical_align', None)) is not None and v > 0:\n        m += f'v={v}:'\n    if (h := c.pop('horizontal_align', None)) is not None and h > 0:\n        m += f'h={h}:'\n    if c:\n        raise Exception('Unknown keys in multicell_command: ' + ', '.join(c))\n    write(f'{OSC}{TEXT_SIZE_CODE};{m.rstrip(\":\")};{text}\\a')\n\n\ndef screen_multi_cursor(rest: str) -> None:\n    write(f'{CSI}>{rest.strip()} q')\n\n\ndef replay(raw: str) -> None:\n    specials = frozenset(\n        {\n            'draw',\n            'set_title',\n            'set_icon',\n            'set_dynamic_color',\n            'set_color_table_color',\n            'select_graphic_rendition',\n            'process_cwd_notification',\n            'clipboard_control',","sourceCodeStart":304,"sourceCodeEnd":340,"githubUrl":"https://github.com/kovidgoyal/kitty/blob/6d5d0c440603ad9bdf6dcd599f73f6dde21acb44/kitty/client.py#L304-L340","documentation":"client.multicell_command builds an OSC 50-style text-size escape sequence and raises a plain Exception when the passed command dict contains keys it does not recognize, to catch typos or unsupported options early.","triggerScenarios":"Calling multicell_command with a dict containing keys other than the supported ones (text, cells/width-height, d, vertical_align, horizontal_align, etc.).","commonSituations":"Scripts generating text-size escape codes passing extra/misspelled keys, or using options added after this code version.","solutions":["Remove unknown keys from the dict; check the function source for supported keys","Fix key typos (e.g. 'valign' vs 'vertical_align')","Update kitty so the command supports the newer keys"],"exampleFix":"# before\nmulticell_command({'text': 'hi', 'valign': 2})\n# after\nmulticell_command({'text': 'hi', 'vertical_align': 2})","handlingStrategy":"validation","validationCode":"ALLOWED = {'text','cells','d','vertical_align','horizontal_align','h','v'}  # per source\ncleaned = {k: v for k, v in cmd.items() if k in ALLOWED}","typeGuard":"def is_valid_multicell_cmd(c: dict) -> bool:\n    allowed = {'text','cells','d','vertical_align','horizontal_align'}\n    return set(c) <= allowed","tryCatchPattern":"try:\n    multicell_command(cmd)\nexcept Exception as e:\n    if 'Unknown keys in multicell_command' in str(e):\n        cmd = {k: v for k, v in cmd.items() if k in ALLOWED}\n        multicell_command(cmd)\n    else:\n        raise","preventionTips":["Build command dicts from a typed dataclass with fixed fields","Keep a constant set of supported keys next to the call site"],"tags":["kitty","escape-sequence","text-size","validation"],"backgroundTag":"unknown-dict-key","analyzedSha":"6d5d0c440603ad9bdf6dcd599f73f6dde21acb44","analyzedAt":"2026-08-27T14:20:20.142Z","schemaVersion":2},"datasetVersion":"2026-08-27T19:17:21.184Z"}