{"record":{"id":"6a714a0a75dda055","repo":"kovidgoyal/kitty","slug":"invalid-underline-exclusion-with-non-numeric-value","errorCode":null,"errorMessage":"Invalid underline_exclusion with non numeric value: {x}","messagePattern":"Invalid underline_exclusion with non numeric value: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"kitty/options/utils.py","lineNumber":1194,"sourceCode":"\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:\n        alias_name, rest = parts\n        yield alias_name, rest\n\n","sourceCodeStart":1176,"sourceCodeEnd":1212,"githubUrl":"https://github.com/kovidgoyal/kitty/blob/6d5d0c440603ad9bdf6dcd599f73f6dde21acb44/kitty/options/utils.py#L1176-L1212","documentation":"Raised when underline_exclusion has a valid px/pt unit suffix but the numeric part before it cannot be parsed as a float.","triggerScenarios":"Values like 'px', 'abcpx', '-px', or '.px' — the last two chars are px/pt but float(x[:-2]) fails.","commonSituations":"Typos in the number, stray characters, or copy/paste artifacts in kitty.conf.","solutions":["Ensure a valid decimal number precedes the unit, e.g. 2.5px","Remove stray characters before the unit"],"exampleFix":"# before\nunderline_exclusion abcp x\n# after\nunderline_exclusion 2.5px","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":["Ensure the numeric prefix parses as float before the unit"],"tags":["kitty","config","number-format"],"backgroundTag":"invalid-numeric-value","analyzedSha":"6d5d0c440603ad9bdf6dcd599f73f6dde21acb44","analyzedAt":"2026-08-27T14:20:20.142Z","schemaVersion":2},"datasetVersion":"2026-08-27T19:17:21.184Z"}