{"record":{"id":"e55942a62e997013","repo":"kovidgoyal/kitty","slug":"invalid-number-for-func-rest","errorCode":null,"errorMessage":"Invalid number for {func}: {rest}","messagePattern":"Invalid number for (.+?): (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"kitty/options/utils.py","lineNumber":368,"sourceCode":"        log_error('Too few arguments to remote_control function')\n    return func, args\n\n\n@func_with_args('remote_control_script')\ndef remote_control_script(func: str, rest: str) -> FuncArgsType:\n    func, args = shlex_parse(func, rest)\n    if len(args) < 1:\n        log_error('Too few arguments to remote_control_script function')\n    return func, args\n\n\n@func_with_args('nth_os_window', 'nth_window', 'visual_window_select_action_trigger', 'next_layout')\ndef single_integer_arg(func: str, rest: str) -> FuncArgsType:\n    try:\n        num = int(rest)\n    except Exception:\n        if rest:\n            log_error(f'Invalid number for {func}: {rest}')\n        num = 1\n    return func, [num]\n\n\n@func_with_args('scroll_to_prompt')\ndef scroll_to_prompt(func: str, rest: str) -> FuncArgsType:\n    vals = rest.strip().split()\n    args = [-1, 0]\n    if len(vals) > 2:\n        log_error('scroll_to_prompt needs one or two arguments, using defaults')\n    else:\n        try:\n            args[0] = int(vals[0])\n        except Exception:\n            log_error(f'{vals[0]} is not a valid number of prompts to jump for scroll_to_prompt')\n        if len(vals) == 2:\n            try:\n                args[1] = int(vals[1])","sourceCodeStart":350,"sourceCodeEnd":386,"githubUrl":"https://github.com/kovidgoyal/kitty/blob/6d5d0c440603ad9bdf6dcd599f73f6dde21acb44/kitty/options/utils.py#L350-L386","documentation":"An integer-requiring action (nth_os_window, nth_window, visual_window_select_action_trigger, next_layout) got a non-numeric argument; kitty falls back to 1. Empty rest is silently treated as 1 without logging.","triggerScenarios":"`map f1 nth_window first` — int(rest) raises ValueError because the token isn't numeric.","commonSituations":"Writing ordinals or words instead of numbers; stray characters like '2nd' or '#2'.","solutions":["Use a plain integer, e.g. `map f1 nth_window 3`","Remove suffixes/words from the numeric argument"],"exampleFix":"# before\nmap f1 nth_window 2nd\n# after\nmap f1 nth_window 2","handlingStrategy":"validation","validationCode":"ok = '3'.lstrip('+-').isdigit()","typeGuard":null,"tryCatchPattern":null,"preventionTips":["nth_window/nth_os_window/next_layout take bare integers","Ordinals like '2nd' are invalid"],"tags":["kitty","config","parser","integer-parse"],"backgroundTag":"invalid-config-value","analyzedSha":"6d5d0c440603ad9bdf6dcd599f73f6dde21acb44","analyzedAt":"2026-08-27T14:20:20.142Z","schemaVersion":2},"datasetVersion":"2026-08-27T19:17:21.184Z"}