{"record":{"id":"03f8becb646f97c9","repo":"kovidgoyal/kitty","slug":"invalid-shortcut","errorCode":null,"errorMessage":"Invalid shortcut","messagePattern":"Invalid shortcut","errorType":"validation","errorClass":"InvalidMods","httpStatus":null,"severity":"error","filePath":"kitty/options/utils.py","lineNumber":580,"sourceCode":"        if src & (src - 1):\n            bad('the source must name exactly one modifier')\n            return {}\n        if src == dest:\n            bad('the source and destination are the same')\n            return {}\n        ans[src] = dest\n    return ans\n\n\ndef parse_shortcut(sc: str) -> SingleKey:\n    if sc.endswith('+') and len(sc) > 1:\n        sc = f'{sc[:-1]}plus'\n    parts = sc.split('+')\n    mods = 0\n    if len(parts) > 1:\n        mods = parse_mods(parts[:-1], sc) or 0\n        if not mods:\n            raise InvalidMods('Invalid shortcut')\n    q = parts[-1]\n    q = character_key_name_aliases_with_ascii_lowercase.get(q.upper(), q)\n    is_native = False\n    if q.startswith('0x'):\n        try:\n            key = int(q, 16)\n        except Exception:\n            key = 0\n        else:\n            is_native = True\n    else:\n        try:\n            key = ord(q)\n        except Exception:\n            uq = q.upper()\n            uq = functional_key_name_aliases.get(uq, uq)\n            x: int | None = getattr(defines, f'GLFW_FKEY_{uq}', None)\n            if x is None:","sourceCodeStart":562,"sourceCodeEnd":598,"githubUrl":"https://github.com/kovidgoyal/kitty/blob/6d5d0c440603ad9bdf6dcd599f73f6dde21acb44/kitty/options/utils.py#L562-L598","documentation":"parse_shortcut raises InvalidMods('Invalid shortcut') when a key spec contains modifier components but parse_mods returns 0, i.e. no valid modifier names (shift/ctrl/alt/super) were found before the '+'. This is a subclass of ValueError used during parse_map processing of keyboard shortcuts.","triggerScenarios":"map lines like map ctrl+foo echo hi where 'foo' before the final segment is not a modifier; e.g. map caps+x ... or stray '+' patterns like map +x ...","commonSituations":"Typos in modifiers (control vs ctrl, command vs super on non-mac docs), keyboard layout guides using wrong modifier names, extra '+' characters.","solutions":["Use correct modifier names: ctrl, alt, shift, super (or cmd/meta aliases)","Remove stray plus signs; a literal '+' key is written as 'plus'","Check the map action syntax in kitty docs"],"exampleFix":"# before\nmap control+x copy_to_clipboard\n# after\nmap ctrl+x copy_to_clipboard","handlingStrategy":"validation","validationCode":"MODS = {'ctrl','shift','alt','super','meta','cmd','control'}\ndef valid_shortcut(sc: str) -> bool:\n    parts = sc.split('+')\n    return all(p.lower() in MODS for p in parts[:-1]) and bool(parts[-1])","typeGuard":null,"tryCatchPattern":"try:\n    parse_shortcut(sc)\nexcept ValueError:\n    skip_binding(sc)","preventionTips":["Use kitty's canonical modifier names (ctrl/alt/shift/super)","Write literal '+' as 'plus'"],"tags":["kitty","config","keyboard","shortcuts"],"backgroundTag":"config-value-validation-failed","analyzedSha":"6d5d0c440603ad9bdf6dcd599f73f6dde21acb44","analyzedAt":"2026-08-27T14:20:20.142Z","schemaVersion":2},"datasetVersion":"2026-08-27T19:17:21.184Z"}