kovidgoyal/kitty · warning

Percentage adjustments of {key} must be positive numbers

Error message

Percentage adjustments of {key} must be positive numbers

What it means

Legacy adjust_line_height/adjust_baseline/adjust_column_width with a percentage value must be a positive number; negative percentages log this and are ignored (non-percentage values are treated as pixel ints).

Source

Thrown at kitty/options/utils.py:1916

    def abort(msg: str) -> None:
        log_error(f'Send text: {val} is invalid ({msg}), ignoring')

    if len(parts) < 3:
        return abort('Incomplete')
    mode, sc = parts[:2]
    text = ' '.join(parts[2:])
    key_str = f'{sc} send_text {mode} {text}'
    for k in parse_map(key_str):
        ans['map'].append(k)


def deprecated_adjust_line_height(key: str, x: str, opts_dict: dict[str, Any]) -> None:
    fm = {'adjust_line_height': 'cell_height', 'adjust_baseline': 'baseline', 'adjust_column_width': 'cell_width'}[key]
    mtype = getattr(ModificationType, fm)
    if x.endswith('%'):
        ans = float(x[:-1].strip())
        if ans < 0:
            log_error(f'Percentage adjustments of {key} must be positive numbers')
            return
        opts_dict['modify_font'][fm] = FontModification(mtype, ModificationValue(ans, ModificationUnit.percent))
    else:
        opts_dict['modify_font'][fm] = FontModification(mtype, ModificationValue(int(x), ModificationUnit.pixel))


def deprecated_scrollback_indicator_opacity(key: str, val: str, ans: dict[str, Any]) -> None:
    if not hasattr(deprecated_scrollback_indicator_opacity, key):
        setattr(deprecated_scrollback_indicator_opacity, key, True)
        log_error(f'The option {key} is deprecated. Use scrollbar instead.')
    op = unit_float(val)
    if op <= 0.001:
        ans['scrollbar'] = 'never'
    else:
        ans['scrollbar_handle_opacity'] = op

View on GitHub (pinned to 6d5d0c4406)

Solutions

  1. Use a positive percentage or switch to modify_font with pixel values for shrinking: modify_font cell_height -2px (legacy adjust_* pixel path accepts int).
  2. Prefer modern: modify_font cell_height +10% and modify_font cell_height -2px as needed.
  3. Remove the negative percent value.

Example fix

# before
adjust_line_height -10%

# after
modify_font cell_height 90%
Defensive patterns

Strategy: validation

Validate before calling

def valid_adjust_percent(x: str) -> bool:
    if x.endswith('%'):
        try:
            return float(x[:-1].strip()) >= 0
        except ValueError:
            return False
    return True

Type guard

def is_nonneg_percent(x: str) -> bool:
    if not x.endswith('%'):
        return True
    core = x[:-1].strip()
    try:
        return float(core) >= 0
    except ValueError:
        return False

Prevention

When it happens

Trigger: 'adjust_line_height -10%' in kitty.conf.

Common situations: Attempting to shrink cells with a negative percentage, which kitty forbids in the legacy option (modify_font percent also expects positive).

Related errors


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