kovidgoyal/kitty · warning

Ignoring invalid modify_font with unknown modification type:

Error message

Ignoring invalid modify_font with unknown modification type: {parts[pos]}

What it means

The first token of modify_font must be a valid ModificationType attribute (size, cell_height, cell_width, baseline, etc.). getattr lookup failed, so the directive is ignored.

Source

Thrown at kitty/options/utils.py:1096

    if parts[0]:
        features = []
        for feat in parts[1:]:
            try:
                features.append(defines.ParsedFontFeature(feat))
            except ValueError:
                log_error(f'Ignoring invalid font feature: {feat}')
        yield parts[0], tuple(features)


def modify_font(val: str) -> Iterable[tuple[str, FontModification]]:
    parts = val.split()
    pos, plen = 0, len(parts)
    if plen < 2:
        log_error(f'Ignoring invalid modify_font: {val}')
        return
    mtype: ModificationType | None = getattr(ModificationType, parts[pos], None)
    if mtype is None:
        log_error(f'Ignoring invalid modify_font with unknown modification type: {parts[pos]}')
        return
    pos += 1
    font_name = ''
    if mtype is ModificationType.size:
        font_name = parts[pos]
        pos += 1
    if plen - pos < 1:
        log_error(f'Ignoring invalid modify_font: {val}')
        return
    sz = parts[pos]
    pos += 1
    munit = ModificationUnit.pt
    if sz.endswith('%'):
        munit = ModificationUnit.percent
        sz = sz[:-1]
    elif sz.endswith('px'):
        munit = ModificationUnit.pixel
        sz = sz[:-2]

View on GitHub (pinned to 6d5d0c4406)

Solutions

  1. Use a valid modification type: size, cell_height, cell_width, baseline (per your kitty version's docs).
  2. Correct typos like 'heights' -> 'height' types.
  3. Upgrade kitty if the type only exists in newer versions.

Example fix

# before
modify_font height +2

# after
modify_font cell_height +2px
Defensive patterns

Strategy: type-guard

Type guard

from kitty.font import ModificationType
def is_modification_type(tok: str) -> bool:
    return getattr(ModificationType, tok, None) is not None

Prevention

When it happens

Trigger: modify_font with a misspelled or unsupported type, e.g. 'modify_font height 5' (should be cell_height) or 'modify_font weight bold'.

Common situations: Version differences where newer modification types are unavailable in older kitty; guessing type names instead of checking docs.

Related errors


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