kovidgoyal/kitty · error · ValueError

cubic-bezier easing function must have four points

Error message

cubic-bezier easing function must have four points

What it means

EasingFunction.cubic_bezier requires exactly four numeric parameters (x1,y1,x2,y2) for the bezier curve; after normalizing commas to spaces it must split into exactly 4 tokens.

Source

Thrown at kitty/options/utils.py:1658

    jump_type: JumpTypes = 'end'

    linear_x: tuple[float, ...] = ()
    linear_y: tuple[float, ...] = ()

    cubic_bezier_points: tuple[float, ...] = ()

    def __repr__(self) -> str:
        fields = ', '.join(f'{f}={getattr(self, f)!r}' for f in self._fields if getattr(self, f) != self._field_defaults[f])
        return f'kitty.options.utils.EasingFunction({fields})'

    def __bool__(self) -> bool:
        return bool(self.type)

    @classmethod
    def cubic_bezier(cls, params: str) -> 'EasingFunction':
        parts = params.replace(',', ' ').split()
        if len(parts) != 4:
            raise ValueError('cubic-bezier easing function must have four points')
        return cls(type='cubic-bezier', cubic_bezier_points=(unit_float(parts[0]), float(parts[1]), unit_float(parts[2]), float(parts[3])))

    @classmethod
    def linear(cls, params: str) -> 'EasingFunction':
        parts = params.split(',')
        if len(parts) < 2:
            raise ValueError('Must specify at least two points for the linear easing function')
        xaxis: list[float] = []
        yaxis: list[float] = []

        def balance(end: float) -> None:
            extra = len(yaxis) - len(xaxis)
            if extra <= 0:
                return
            start = xaxis[-1] if xaxis else 0.0
            delta = (end - start) / max(1, extra - 1)
            if delta <= 0.0:
                raise ValueError(f'Linear easing curve must have strictly increasing points: {params} does not')

View on GitHub (pinned to 6d5d0c4406)

Solutions

  1. Supply exactly four numbers: cubic-bezier(x1, y1, x2, y2)
  2. Prefer named easings (ease, ease-in-out) which kitty expands for you

Example fix

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

Strategy: validation

Validate before calling

def valid_cubic_bezier(params: str) -> bool:
    return len(params.replace(',', ' ').split()) == 4

Prevention

When it happens

Trigger: A cursor_blink_interval or animation spec like 'cubic-bezier(0.42, 0)' (2 points) or 5 points; extra tokens also fail.

Common situations: Hand-writing CSS-like easing in kitty config and omitting a coordinate; copying truncated CSS examples.

Related errors


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