{"record":{"id":"79f6368c2d8bb7cb","repo":"kovidgoyal/kitty","slug":"parts-1-is-not-a-number","errorCode":null,"errorMessage":"{parts[1]} is not a number","messagePattern":"(.+?) is not a number","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"kitty/rc/set_spacing.py","lineNumber":60,"sourceCode":"        mapper[f'{q}-h'] = mapper[f'{q}-horizontal'] = f'{q}-left {q}-right'.split()\n        mapper[f'{q}-v'] = mapper[f'{q}-vertical'] = f'{q}-top {q}-bottom'.split()\n        for edge in ('left', 'top', 'right', 'bottom'):\n            mapper[f'{q}-{edge}'] = [f'{q}-{edge}']\n    settings: dict[str, float | None] = {}\n    for spec in args:\n        parts = spec.split('=', 1)\n        if len(parts) != 2:\n            raise ValueError(f'{spec} is not a valid setting')\n        which = mapper.get(parts[0].lower())\n        if not which:\n            raise ValueError(f'{parts[0]} is not a valid edge specification')\n        if parts[1].lower() == 'default':\n            val = None\n        else:\n            try:\n                val = float(parts[1])\n            except Exception:\n                raise ValueError(f'{parts[1]} is not a number')\n        for q in which:\n            settings[q] = val\n    return settings\n\n\nclass SetSpacing(RemoteCommand):\n    protocol_spec = __doc__ = \"\"\"\n    settings+/dict.spacing: An object mapping margins/paddings using canonical form {'margin-top': 50, 'padding-left': null} etc\n    match_window/str: Window to change paddings and margins in\n    match_tab/str: Tab to change paddings and margins in\n    all/bool: Boolean indicating change paddings and margins everywhere or not\n    configured/bool: Boolean indicating whether to change the configured paddings and margins. Must be True if reset is True\n    \"\"\"\n\n    short_desc = 'Set window paddings and margins'\n    desc = (\n        'Set the paddings and margins for the specified windows (defaults to active window).'\n        ' For example: :code:`margin=20` or :code:`padding-left=10` or :code:`margin-h=30`. The shorthand form sets'","sourceCodeStart":42,"sourceCodeEnd":78,"githubUrl":"https://github.com/kovidgoyal/kitty/blob/6d5d0c440603ad9bdf6dcd599f73f6dde21acb44/kitty/rc/set_spacing.py#L42-L78","documentation":"The right-hand side of a spacing spec must be a float or the literal 'default'; float() failure raises ValueError '{parts[1]} is not a number'.","triggerScenarios":"Passing non-numeric values like 'margin=wide' or 'padding=10px' (units are not accepted).","commonSituations":"Including units (px, em) or other text in the value.","solutions":["Use a bare number (interpreted as points) or 'default', e.g. 'margin=10' or 'margin=default'","Remove unit suffixes like px"],"exampleFix":"# before\nkitten @set-spacing margin=10px\n# after\nkitten @set-spacing margin=10","handlingStrategy":"validation","validationCode":"def valid_val(v): \n    try: float(v); return True\n    except ValueError: return v.lower()=='default'","typeGuard":"def is_number_or_default(v: str) -> bool:\n    if v.lower()=='default': return True\n    try: float(v); return True\n    return False","tryCatchPattern":null,"preventionTips":["Never include units like px in spacing values"],"tags":["kitty","cli-args","validation"],"backgroundTag":"invalid-numeric-value","analyzedSha":"6d5d0c440603ad9bdf6dcd599f73f6dde21acb44","analyzedAt":"2026-08-27T14:20:20.142Z","schemaVersion":2},"datasetVersion":"2026-08-27T19:17:21.184Z"}