remotion-dev/remotion · error · Error

inputRange (${inputRange.length}) and outputRange (${outputR

Error message

inputRange (${inputRange.length}) and outputRange (${outputRange.length}) must have the same length

What it means

Thrown by interpolate() when inputRange.length !== outputRange.length. Each input keyframe must map to exactly one output keyframe, so the two arrays must have the same number of elements; interpolation cannot proceed otherwise.

Source

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

	input: number,
	inputRange: readonly number[],
	outputRange: readonly InterpolateOutputValue[],
	options?: InterpolateOptions,
): number | string | readonly number[] {
	if (typeof input === 'undefined') {
		throw new Error('input can not be undefined');
	}

	if (typeof inputRange === 'undefined') {
		throw new Error('inputRange can not be undefined');
	}

	if (typeof outputRange === 'undefined') {
		throw new Error('outputRange can not be undefined');
	}

	if (inputRange.length !== outputRange.length) {
		throw new Error(
			'inputRange (' +
				inputRange.length +
				') and outputRange (' +
				outputRange.length +
				') must have the same length',
		);
	}

	checkInfiniteRange('inputRange', inputRange);
	checkValidInputRange(inputRange);

	assertValidInterpolateEasingOption(options?.easing, inputRange.length);
	assertValidInterpolatePosterizeOption(options?.posterize);
	assertValidInterpolateOutputOption(options?.output);

	if (typeof input !== 'number') {
		throw new TypeError('Cannot interpolate an input which is not a number');
	}

View on GitHub (pinned to 78fe4bb3fd)

Solutions

  1. Make inputRange and outputRange the same length.
  2. Build both arrays from a single keyframe definition so they stay in sync.
  3. Read the counts in the error message to see which array is shorter/longer.

Example fix

// before
const r = interpolate(t, [0, 1, 2], [0, 100]);
// after
const r = interpolate(t, [0, 1, 2], [0, 50, 100]);
Defensive patterns

Strategy: validation

Validate before calling

if (inputRange.length !== outputRange.length) {
  throw new Error(`inputRange and outputRange lengths differ`);
}
const r = interpolate(input, inputRange, outputRange);

Type guard

const sameLength = (
  a: readonly unknown[],
  b: readonly unknown[],
): boolean => a.length === b.length;

Prevention

When it happens

Trigger: interpolate(0, [0,1,2], [0,100]); adding a keyframe to one array but not the other; ranges built from different data sources whose lengths diverge.

Common situations: Editing keyframes and forgetting to keep both arrays in sync; copy-pasting a range and trimming one side; data-driven ranges where input and output come from mismatched lists.

Related errors


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