{"record":{"id":"141d645004a795b5","repo":"kovidgoyal/kitty","slug":"invalid-range-a-x-b-x","errorCode":null,"errorMessage":"Invalid range: {a:x} - {b:x}","messagePattern":"Invalid range: (.+?) - (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"kitty/options/utils.py","lineNumber":1233,"sourceCode":"\ndef symbol_map_parser(val: str, min_size: int = 2) -> Iterable[tuple[tuple[int, int], str]]:\n    parts = val.split()\n\n    if len(parts) < min_size:\n        raise ValueError('must have codepoints AND font name')\n    family = ' '.join(parts[1:])\n\n    def to_chr(x: str) -> int:\n        if not x.startswith('U+'):\n            raise ValueError(f'{x} is not a unicode codepoint of the form U+number')\n        return int(x[2:], 16)\n\n    for x in parts[0].split(','):\n        a_, b_ = x.replace('–', '-').partition('-')[::2]\n        b_ = b_ or a_\n        a, b = map(to_chr, (a_, b_))\n        if b < a or max(a, b) > sys.maxunicode or min(a, b) < 1:\n            raise ValueError(f'Invalid range: {a:x} - {b:x}')\n        yield (a, b), family\n\n\ndef symbol_map(val: str) -> Iterable[tuple[tuple[int, int], str]]:\n    yield from symbol_map_parser(val)\n\n\ndef narrow_symbols(val: str) -> Iterable[tuple[tuple[int, int], int]]:\n    for x, y in symbol_map_parser(val, min_size=1):\n        yield x, int(y or 1)\n\n\ndef parse_key_action(action: str, action_type: MapType = MapType.MAP) -> KeyAction:\n    parts = action.strip().split(maxsplit=1)\n    func = parts[0]\n    if len(parts) == 1:\n        return KeyAction(func, ())\n    rest = parts[1]","sourceCodeStart":1215,"sourceCodeEnd":1251,"githubUrl":"https://github.com/kovidgoyal/kitty/blob/6d5d0c440603ad9bdf6dcd599f73f6dde21acb44/kitty/options/utils.py#L1215-L1251","documentation":"After parsing codepoints, kitty validates each range: the end must not be below the start, values must be within 1..sys.maxunicode. Violations raise this error showing the hex values.","triggerScenarios":"Ranges like U+E0A2-U+E0A0 (reversed), U+0 (below 1), or values above U+10FFFF.","commonSituations":"Reversed range endpoints when hand-editing, or accidentally using codepoints beyond Unicode's maximum.","solutions":["Ensure range start <= end","Keep values between U+1 and U+10FFFF"],"exampleFix":"# before\nsymbol_map U+E0A2-U+E0A0 Nerd Font\n# after\nsymbol_map U+E0A0-U+E0A2 Nerd Font","handlingStrategy":"validation","validationCode":"import sys\ndef valid_range(a: int, b: int) -> bool:\n    return a <= b and 1 <= max(a, b) <= sys.maxunicode","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep ranges ascending and within U+1..U+10FFFF"],"tags":["kitty","config","unicode","range-validation"],"backgroundTag":"value-out-of-range","analyzedSha":"6d5d0c440603ad9bdf6dcd599f73f6dde21acb44","analyzedAt":"2026-08-27T14:20:20.142Z","schemaVersion":2},"datasetVersion":"2026-08-27T19:17:21.184Z"}