{"record":{"id":"28da3f1d38ea2a62","repo":"kovidgoyal/kitty","slug":"clear-terminal-needs-two-arguments-using-defaults","errorCode":null,"errorMessage":"clear_terminal needs two arguments, using defaults","messagePattern":"clear_terminal needs two arguments, using defaults","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"kitty/options/utils.py","lineNumber":253,"sourceCode":"def parse_change_font_size(func: str, rest: str) -> tuple[str, tuple[bool, str | None, float]]:\n    vals = rest.strip().split(maxsplit=1)\n    if len(vals) != 2:\n        log_error(f'Invalid change_font_size specification: {rest}, treating it as default')\n        return func, (True, None, 0)\n    c_all = vals[0].lower() == 'all'\n    sign: str | None = None\n    amt = vals[1]\n    if amt[0] in '+-*/':\n        sign = amt[0]\n        amt = amt[1:]\n    return func, (c_all, sign, float(amt.strip()))\n\n\n@func_with_args('clear_terminal')\ndef clear_terminal(func: str, rest: str) -> FuncArgsType:\n    vals = rest.strip().split(maxsplit=1)\n    if len(vals) != 2:\n        log_error('clear_terminal needs two arguments, using defaults')\n        args = ['reset', True]\n    else:\n        action = vals[0].lower()\n        if action not in ('reset', 'scroll', 'scrollback', 'clear', 'to_cursor', 'to_cursor_scroll', 'last_command'):\n            log_error(f'{action} is unknown for clear_terminal, using reset')\n            action = 'reset'\n        args = [action, vals[1].lower() == 'active']\n    return func, args\n\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]","sourceCodeStart":235,"sourceCodeEnd":271,"githubUrl":"https://github.com/kovidgoyal/kitty/blob/6d5d0c440603ad9bdf6dcd599f73f6dde21acb44/kitty/options/utils.py#L235-L271","documentation":"The clear_terminal action in a map definition needs two arguments (an action and 'active'/'inactive') but fewer were provided. kitty substitutes defaults ['reset', True] so the mapping still triggers a reset.","triggerScenarios":"`map f1 clear_terminal reset` (single token) or an empty argument string — rest.strip().split(maxsplit=1) yields fewer than 2 parts.","commonSituations":"Writing clear_terminal with only the action and forgetting the second boolean-ish argument in kitty.conf.","solutions":["Provide both arguments, e.g. `map f1 clear_terminal reset active`","Use one of the valid actions: reset, scroll, scrollback, clear, to_cursor, to_cursor_scroll, last_command"],"exampleFix":"# before\nmap f1 clear_terminal reset\n# after\nmap f1 clear_terminal reset active","handlingStrategy":"validation","validationCode":"rest = 'reset active'\nvals = rest.strip().split(maxsplit=1)\nok = len(vals) == 2 and vals[0].lower() in ('reset','scroll','scrollback','clear','to_cursor','to_cursor_scroll','last_command')","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always give clear_terminal two arguments","Copy canonical examples from kitty's default config"],"tags":["kitty","config","terminal","parser"],"backgroundTag":"invalid-config-value","analyzedSha":"6d5d0c440603ad9bdf6dcd599f73f6dde21acb44","analyzedAt":"2026-08-27T14:20:20.142Z","schemaVersion":2},"datasetVersion":"2026-08-27T19:17:21.184Z"}