kovidgoyal/kitty · error · KeyError

{func_name} is not a valid easing function

Error message

{func_name} is not a valid easing function

What it means

Inside a parameterized easing spec, only cubic-bezier, linear, and steps are recognized function names; any other name with parentheses raises KeyError.

Source

Thrown at kitty/options/utils.py:1747

def parse_animation(spec: str, interval: float = -1.0) -> tuple[float, EasingFunction, EasingFunction]:
    with suppress(Exception):
        interval = float(spec)
        return interval, EasingFunction(), EasingFunction()

    m = [EasingFunction(), EasingFunction()]

    def parse_func(func_name: str, params: str) -> None:
        idx = 1 if m[0] else 0
        if m[idx]:
            raise ValueError(f'{spec} specified more than two easing functions')
        if func_name == 'cubic-bezier':
            m[idx] = EasingFunction.cubic_bezier(params)
        elif func_name == 'linear':
            m[idx] = EasingFunction.linear(params)
        elif func_name == 'steps':
            m[idx] = EasingFunction.steps(params)
        else:
            raise KeyError(f'{func_name} is not a valid easing function')

    for match in re.finditer(r'([-+.0-9a-zA-Z]+)(?:\(([^)]*)\)){0,1}', spec):
        func_name, params = match.group(1, 2)
        if params:
            parse_func(func_name, params)
            continue
        with suppress(Exception):
            interval = float(func_name)
            continue
        if func_name == 'ease-in-out':
            parse_func('cubic-bezier', '0.42, 0, 0.58, 1')
        elif func_name == 'linear':
            parse_func('cubic-bezier', '0, 0, 1, 1')
        elif func_name == 'ease':
            parse_func('cubic-bezier', '0.25, 0.1, 0.25, 1')
        elif func_name == 'ease-out':
            parse_func('cubic-bezier', '0, 0, 0.58, 1')
        elif func_name == 'ease-in':

View on GitHub (pinned to 6d5d0c4406)

Solutions

  1. Use cubic-bezier(), linear(), or steps() with parameters
  2. Use bare named easings (ease, ease-in, etc.) without parentheses

Example fix

# before
cursor_blink_interval 0.5:spring(1, 2)
# after
cursor_blink_interval 0.5:cubic-bezier(0.42, 0, 1, 1)
Defensive patterns

Strategy: type-guard

Validate before calling

def valid_easing_fn(name: str) -> bool:
    return name in ('cubic-bezier', 'linear', 'steps')

Type guard

def is_param_easing(name: str) -> bool:
    return name in ('cubic-bezier', 'linear', 'steps')

Prevention

When it happens

Trigger: Specs like '0.5:spring(1,2)' or '0.5:ease-in-out(0.4)' — a function-style call with an unknown easing name.

Common situations: Assuming CSS's full easing vocabulary (e.g. spring, bounce) exists in kitty; using parentheses on named easings that take no params.

Related errors


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