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
- Make inputRange and outputRange the same length.
- Build both arrays from a single keyframe definition so they stay in sync.
- 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
- Derive inputRange and outputRange from a single keyframe list.
- Add a unit test asserting length equality for data-driven ranges.
- Re-check both arrays whenever you edit a keyframe.
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
- ${name} must have at least 1 element
- inputRange must be strictly monotonically increasing but got
- inputRange can not be undefined
- outputRange can not be undefined
- outputRange must contain only numbers
AI-assisted analysis of remotion-dev/remotion@78fe4bb3fd (2026-08-12).
Data as JSON: /api/errors/df0cfc65c434cc4e.
Report an issue: GitHub.