kovidgoyal/kitty · error · ValueError

Must specify at least two points for the linear easing funct

Error message

Must specify at least two points for the linear easing function

What it means

EasingFunction.linear needs at least two comma-separated points to define a piecewise-linear curve; a single point or empty parameter string raises this ValueError.

Source

Thrown at kitty/options/utils.py:1665

    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')
            if xaxis:
                for i in range(extra):
                    xaxis.append(start + (i + 1) * delta)
            else:
                for i in range(extra):
                    xaxis.append(i * delta)

View on GitHub (pinned to 6d5d0c4406)

Solutions

  1. Provide at least two points, e.g. linear(0, 1) or linear(0, 0.5, 1)
  2. Use a named easing if you just want simple behavior

Example fix

# before
cursor_blink_interval 0.5:linear(0)
# after
cursor_blink_interval 0.5:linear(0, 1)
Defensive patterns

Strategy: validation

Validate before calling

def valid_linear(params: str) -> bool:
    return len(params.split(',')) >= 2

Prevention

When it happens

Trigger: Specs like 'linear(0)' or 'linear()' in an animation/cursor_blink_interval value.

Common situations: Misunderstanding that one point can't define a curve; typos dropping the second coordinate.

Related errors


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