{"record":{"id":"dbfb288aed893200","repo":"kovidgoyal/kitty","slug":"notify-on-cmd-finish-command-action-needs-a-comm","errorCode":null,"errorMessage":"notify_on_cmd_finish `command` action needs a command line","messagePattern":"notify_on_cmd_finish `command` action needs a command line","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"kitty/options/utils.py","lineNumber":944,"sourceCode":"    cmdline: tuple[str, ...] = ()\n    clear_on = default_clear_on\n    if len(parts) > 2:\n        if parts[2] not in ('notify', 'bell', 'notify-bell', 'command'):\n            raise ValueError(f'Unknown notify_on_cmd_finish action: {parts[2]}')\n        action = parts[2]\n        if action.startswith('notify'):\n            if len(parts) > 3:\n                con: list[ClearOn] = []\n                for x in parts[3].split():\n                    if x not in all_clear_on:\n                        raise ValueError(f'notify_on_cmd_finish: notify clear_on value \"{x}\" is invalid. Valid values are: {\", \".join(all_clear_on)}')\n                    con.append(cast(ClearOn, x))\n                clear_on = tuple(con)\n        elif action == 'command':\n            if len(parts) > 3:\n                cmdline = tuple(to_cmdline(parts[3]))\n            else:\n                raise ValueError('notify_on_cmd_finish `command` action needs a command line')\n    return NotifyOnCmdFinish(when, duration, action, cmdline, clear_on)\n\n\ndef config_or_absolute_path(x: str, env: dict[str, str] | None = None) -> str | None:\n    if not x or x.lower() == 'none':\n        return None\n    return resolve_abs_or_config_path(x, env)\n\n\ndef background_images(x: str) -> tuple[str, ...]:\n    if x.lower() in ('none', ''):\n        return ()\n    from glob import glob\n\n    x = resolve_abs_or_config_path(x, None)\n    return tuple(x for x in sorted(glob(x)) if x.rpartition('.')[-1].lower() in ('jpeg', 'jpg', 'png', 'webp', 'tif', 'tiff', 'bmp', 'gif')) or (x,)\n\n","sourceCodeStart":926,"sourceCodeEnd":962,"githubUrl":"https://github.com/kovidgoyal/kitty/blob/6d5d0c440603ad9bdf6dcd599f73f6dde21acb44/kitty/options/utils.py#L926-L962","documentation":"notify_on_cmd_finish with action 'command' requires a fourth token (the command line to run). If parts has no element after the action, this ValueError is raised.","triggerScenarios":"notify_on_cmd_finish always 5.0 command — action given but no command string follows.","commonSituations":"Forgetting to append the command after 'command', or trailing whitespace-only command that gets split away.","solutions":["Append a shell command after the command action","Quote it if it contains spaces: notify_on_cmd_finish always 5.0 command notify-send done"],"exampleFix":"# before\nnotify_on_cmd_finish always 5.0 command\n# after\nnotify_on_cmd_finish always 5.0 command notify-send 'kitty: command done'","handlingStrategy":"validation","validationCode":"def valid_notify_cmdline(x: str) -> bool:\n    parts = x.split(maxsplit=3)\n    return not (len(parts) > 2 and parts[2] == 'command' and len(parts) < 4)","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always append the command after the 'command' action","Quote multi-word commands"],"tags":["kitty","config","notifications"],"backgroundTag":"config-value-validation-failed","analyzedSha":"6d5d0c440603ad9bdf6dcd599f73f6dde21acb44","analyzedAt":"2026-08-27T14:20:20.142Z","schemaVersion":2},"datasetVersion":"2026-08-27T19:17:21.184Z"}