remotion-dev/remotion · error · Error

When easing is an array, it must have one entry per segment

Error message

When easing is an array, it must have one entry per segment between keyframes (length inputRange.length - 1 = ${expectedLength}), but got length ${easing.length}

What it means

Thrown by assertValidInterpolateEasingOption when options.easing is an array whose length does not equal inputRange.length - 1. There is exactly one easing segment between each pair of adjacent keyframes, so N keyframes require N-1 easing functions.

Source

Thrown at packages/core/src/interpolate.ts:1052

		}
	}
}

export function assertValidInterpolateEasingOption(
	easing: EasingFunction | readonly EasingFunction[] | undefined,
	inputRangeLength: number,
) {
	if (easing === undefined) {
		return;
	}

	if (typeof easing === 'function') {
		return;
	}

	const expectedLength = inputRangeLength - 1;
	if (easing.length !== expectedLength) {
		throw new Error(
			`When easing is an array, it must have one entry per segment between keyframes (length inputRange.length - 1 = ${expectedLength}), but got length ${easing.length}`,
		);
	}

	for (let i = 0; i < easing.length; i++) {
		if (typeof easing[i] !== 'function') {
			throw new Error(`easing[${i}] must be a function`);
		}
	}
}

export function assertValidInterpolatePosterizeOption(
	posterize: number | undefined,
) {
	if (posterize === undefined) {
		return;
	}

View on GitHub (pinned to 78fe4bb3fd)

Solutions

  1. Set the easing array length to inputRange.length - 1.
  2. If the same easing applies to every segment, pass a single function (not an array) instead.
  3. Build the easing array programmatically from the keyframe count.

Example fix

// before
const r = interpolate(t, [0, 1, 2], [0, 50, 100], {easing: [Easing.linear]});
// after
const r = interpolate(t, [0, 1, 2], [0, 50, 100], {easing: [Easing.linear, Easing.ease]});
Defensive patterns

Strategy: validation

Validate before calling

const expected = inputRange.length - 1;
if (Array.isArray(easing) && easing.length !== expected) {
  throw new Error(`easing array must have length ${expected}`);
}
const r = interpolate(input, inputRange, outputRange, {easing});

Type guard

const isEasingArray = (
  e: unknown,
  n: number,
): e is ((t: number) => number)[] =>
  Array.isArray(e) && e.length === n - 1 && e.every((f) => typeof f === 'function');

Prevention

When it happens

Trigger: interpolate(t, [0, 1, 2], [0, 50, 100], {easing: [Easing.linear]}); — needs 2 easing entries for 3 keyframes but only 1 supplied. Also when easing array length is copied from outputRange length by mistake.

Common situations: Adding/removing a keyframe but forgetting to update the easing array; reusing a single easing function array across ranges of different lengths.

Related errors


AI-assisted analysis of remotion-dev/remotion@78fe4bb3fd (2026-08-12). Data as JSON: /api/errors/9e24323cb4092e50. Report an issue: GitHub.