{"record":{"id":"38c355c5535bf480","repo":"kovidgoyal/kitty","slug":"notify-on-cmd-finish-notify-clear-on-value-x","errorCode":null,"errorMessage":"notify_on_cmd_finish: notify clear_on value \"{x}\" is invalid. Valid values are: {\", \".join(all_clear_on)}","messagePattern":"notify_on_cmd_finish: notify clear_on value \"(.+?)\" is invalid\\. Valid values are: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"kitty/options/utils.py","lineNumber":937,"sourceCode":"    if parts[0] not in ('never', 'unfocused', 'invisible', 'always'):\n        raise ValueError(f'Unknown notify_on_cmd_finish value: {parts[0]}')\n    when = parts[0]\n    duration = 5.0\n    if len(parts) > 1:\n        duration = float(parts[1])\n    action = 'notify'\n    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', ''):","sourceCodeStart":919,"sourceCodeEnd":955,"githubUrl":"https://github.com/kovidgoyal/kitty/blob/6d5d0c440603ad9bdf6dcd599f73f6dde21acb44/kitty/options/utils.py#L919-L955","documentation":"When the notify_on_cmd_finish action starts with 'notify', an optional fourth token lists clear_on conditions, each of which must be in all_clear_on. Any invalid word raises this error listing valid values (e.g. visible, focused, unfocused — depending on kitty version).","triggerScenarios":"notify_on_cmd_finish always 5 notify seen or any clear_on word not in the allowed set.","commonSituations":"Guessing clear-condition names, version differences in the allowed clear_on values.","solutions":["Use only the clear_on values shown in the error message","Drop the fourth token to accept defaults"],"exampleFix":"# before\nnotify_on_cmd_finish always 5 notify seen\n# after\nnotify_on_cmd_finish always 5 notify visible","handlingStrategy":"validation","validationCode":"def valid_clear_on(tok: str, all_clear_on: set[str]) -> bool:\n    return all(w in all_clear_on for w in tok.split())","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Source valid clear_on words from kitty's all_clear_on at runtime","Leave the fourth token off for defaults"],"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"}