{"record":{"id":"f082272e6ef1b940","repo":"kovidgoyal/kitty","slug":"ignoring-modify-font-with-invalid-size-sz","errorCode":null,"errorMessage":"Ignoring modify_font with invalid size: {sz}","messagePattern":"Ignoring modify_font with invalid size: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"kitty/options/utils.py","lineNumber":1118,"sourceCode":"    if mtype is ModificationType.size:\n        font_name = parts[pos]\n        pos += 1\n    if plen - pos < 1:\n        log_error(f'Ignoring invalid modify_font: {val}')\n        return\n    sz = parts[pos]\n    pos += 1\n    munit = ModificationUnit.pt\n    if sz.endswith('%'):\n        munit = ModificationUnit.percent\n        sz = sz[:-1]\n    elif sz.endswith('px'):\n        munit = ModificationUnit.pixel\n        sz = sz[:-2]\n    try:\n        mvalue = float(sz)\n    except Exception:\n        log_error(f'Ignoring modify_font with invalid size: {sz}')\n        return\n    key = mtype.name\n    if font_name:\n        key += f':{font_name}'\n    yield key, FontModification(mtype, ModificationValue(mvalue, munit), font_name)\n\n\ndef env(val: str, current_val: dict[str, str]) -> Iterable[tuple[str, str]]:\n    val = val.strip()\n    if val:\n        if '=' in val:\n            key, v = val.split('=', 1)\n            key, v = key.strip(), v.strip()\n            if key:\n                if v:\n                    v = expandvars(v, current_val)\n                yield key, v\n        else:","sourceCodeStart":1100,"sourceCodeEnd":1136,"githubUrl":"https://github.com/kovidgoyal/kitty/blob/6d5d0c440603ad9bdf6dcd599f73f6dde21acb44/kitty/options/utils.py#L1100-L1136","documentation":"The size token of a modify_font directive (after stripping % or px suffix) could not be converted to float, so the directive is ignored.","triggerScenarios":"'modify_font size +2em', 'modify_font size abc', or a token that is only '%' with no number.","commonSituations":"Using unsupported CSS units (em, rem, pt suffix other than recognized bare pt); stray characters; localized decimal commas.","solutions":["Use a plain number (pt), a number with px, or a percentage: '+2px', '110%', '5'.","Remove unsupported unit suffixes.","Check for stray unicode characters in the value."],"exampleFix":"# before\nmodify_font size +2em\n\n# after\nmodify_font size +2px","handlingStrategy":"validation","validationCode":"def valid_size_token(sz: str) -> bool:\n    core = sz[:-1] if sz.endswith('%') else sz[:-2] if sz.endswith('px') else sz\n    try:\n        float(core)\n        return True\n    except ValueError:\n        return False","typeGuard":"def is_float_maybe_suffixed(sz: str) -> bool:\n    for suf in ('%','px'):\n        if sz.endswith(suf):\n            sz = sz[:-len(suf)]\n            break\n    try:\n        float(sz)\n        return True\n    except ValueError:\n        return False","tryCatchPattern":null,"preventionTips":["Use plain numbers, Npx, or N% only","Avoid em/rem/pt-suffix forms in modify_font"],"tags":["kitty","config","font","modify-font"],"backgroundTag":"config-value-validation-failed","analyzedSha":"6d5d0c440603ad9bdf6dcd599f73f6dde21acb44","analyzedAt":"2026-08-27T14:20:20.142Z","schemaVersion":2},"datasetVersion":"2026-08-27T19:17:21.184Z"}