kovidgoyal/kitty · error · ValueError

Invalid box_drawing scale, must have four entries

Error message

Invalid box_drawing scale, must have four entries

What it means

box_drawing_scale validator raises this when the option value does not split into exactly four comma-separated floats. kitty uses four thresholds (0.001, 1.0, 1.95, 2.75 by default) to decide when to use pure-font glyphs for box drawing.

Source

Thrown at kitty/options/utils.py:620

            else:
                key = x

    return SingleKey(mods, is_native, key or 0)


def to_font_size(x: str) -> float:
    return max(MINIMUM_FONT_SIZE, float(x))


def disable_ligatures(x: str) -> int:
    cmap = {'never': 0, 'cursor': 1, 'always': 2}
    return cmap.get(x.lower(), 0)


def box_drawing_scale(x: str) -> tuple[float, float, float, float]:
    ans = tuple(float(q.strip()) for q in x.split(','))
    if len(ans) != 4:
        raise ValueError('Invalid box_drawing scale, must have four entries')
    return ans[0], ans[1], ans[2], ans[3]


def cursor_text_color(x: str) -> Color | None:
    if x.lower() == 'background':
        return None
    return to_color(x)


cshapes = {'block': CURSOR_BLOCK, 'beam': CURSOR_BEAM, 'underline': CURSOR_UNDERLINE}
cshapes_unfocused = {
    'block': CURSOR_BLOCK,
    'beam': CURSOR_BEAM,
    'underline': CURSOR_UNDERLINE,
    'hollow': CURSOR_HOLLOW,
    'unchanged': NO_CURSOR_SHAPE,
}

View on GitHub (pinned to 6d5d0c4406)

Solutions

  1. Provide exactly four comma-separated floats
  2. Restore the default: box_drawing_scale 0.001,1.0,1.95,2.75

Example fix

# before
box_drawing_scale 0.001 1.0 1.95 2.75
# after
box_drawing_scale 0.001,1.0,1.95,2.75
Defensive patterns

Strategy: validation

Validate before calling

def valid_bds(x: str) -> bool:
    parts = [p.strip() for p in x.split(',')]
    return len(parts) == 4 and all(_is_float(p) for p in parts)

Prevention

When it happens

Trigger: Setting box_drawing_scale 0.001 1.0 (spaces, wrong count), or 0.001,1.0,1.95 (three values), or non-numeric entries (which fail float() first with ValueError).

Common situations: Copying a three-value example from an old blog, using spaces instead of commas, editing kitty.conf by hand.

Related errors


AI-assisted analysis of kovidgoyal/kitty@6d5d0c4406 (2026-08-27). Data as JSON: /api/errors/61c5c0368bf17511. Report an issue: GitHub.