{"record":{"id":"d20efa79ae0d684c","repo":"kovidgoyal/kitty","slug":"invalid-underline-exclusion-with-unrecognized-unit","errorCode":null,"errorMessage":"Invalid underline_exclusion with unrecognized unit: {x}","messagePattern":"Invalid underline_exclusion with unrecognized unit: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"kitty/options/utils.py","lineNumber":1190,"sourceCode":"        log_error(f'Invalid shell integration options: {q - allowed_shell_integration_values}, ignoring')\n        return q & allowed_shell_integration_values or frozenset({'invalid'})\n    return q\n\n\ndef confirm_close(x: str) -> tuple[int, bool]:\n    parts = x.split(maxsplit=1)\n    num = int(parts[0])\n    allow_background = len(parts) > 1 and parts[1] == 'count-background'\n    return num, allow_background\n\n\ndef underline_exclusion(x: str) -> tuple[float, Literal['', 'px', 'pt']]:\n    try:\n        return float(x), ''\n    except Exception:\n        unit: Literal['pt', 'px'] = x[-2:]  # type: ignore\n        if unit not in ('px', 'pt'):\n            raise ValueError(f'Invalid underline_exclusion with unrecognized unit: {x}')\n        try:\n            val = float(x[:-2])\n        except Exception:\n            raise ValueError(f'Invalid underline_exclusion with non numeric value: {x}')\n        return val, unit\n\n\ndef paste_actions(x: str) -> frozenset[str]:\n    s = frozenset({'quote-urls-at-prompt', 'confirm', 'filter', 'confirm-if-large', 'replace-dangerous-control-codes', 'replace-newline', 'no-op'})\n    q = frozenset(x.lower().split(','))\n    if not q.issubset(s):\n        raise ValueError(f'Invalid paste actions: {q - s}, ignoring')\n    return q\n\n\ndef action_alias(val: str) -> Iterable[tuple[str, str]]:\n    parts = val.split(maxsplit=1)\n    if len(parts) > 1:","sourceCodeStart":1172,"sourceCodeEnd":1208,"githubUrl":"https://github.com/kovidgoyal/kitty/blob/6d5d0c440603ad9bdf6dcd599f73f6dde21acb44/kitty/options/utils.py#L1172-L1208","documentation":"kitty's underline_exclusion option parser accepts a plain number or a number with a 'px' or 'pt' unit suffix. This error fires when the value is not a plain float and its last two characters are not a recognized unit.","triggerScenarios":"Setting underline_exclusion to something like '3em', '3mm', or a bare non-numeric string; the code tries float(x) first, then checks x[-2:] against ('px','pt') and rejects anything else.","commonSituations":"Using CSS-style units kitty does not support (em, rem, cm), misspelling px/pt, or passing an empty string.","solutions":["Use a plain number (e.g. 3) or a number with px or pt suffix (e.g. 3px, 2pt)","Remove unsupported unit suffixes from the value"],"exampleFix":"# before\nunderline_exclusion 3em\n# after\nunderline_exclusion 3px","handlingStrategy":"validation","validationCode":"import re\ndef valid_underline_exclusion(v: str) -> bool:\n    return bool(re.fullmatch(r'-?\\d+(\\.\\d+)?(px|pt)?', v))","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Restrict units to px/pt or plain numbers"],"tags":["kitty","config","units","typography"],"backgroundTag":"invalid-unit-suffix","analyzedSha":"6d5d0c440603ad9bdf6dcd599f73f6dde21acb44","analyzedAt":"2026-08-27T14:20:20.142Z","schemaVersion":2},"datasetVersion":"2026-08-27T19:17:21.184Z"}