remotion-dev/remotion · error · Error

${name} must have at least 1 element

Error message

${name} must have at least 1 element

What it means

Thrown by checkInfiniteRange when the named array (inputRange or outputRange) has fewer than 1 element. Interpolation needs at least one keyframe to produce a value, so an empty range is unrecoverable. The message substitutes the array name ('inputRange' or 'outputRange').

Source

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

		}),
	);
};

function checkValidInputRange(arr: readonly number[]) {
	for (let i = 1; i < arr.length; ++i) {
		if (!(arr[i] > arr[i - 1])) {
			throw new Error(
				`inputRange must be strictly monotonically increasing but got [${arr.join(
					',',
				)}]`,
			);
		}
	}
}

function checkInfiniteRange(name: string, arr: readonly number[]) {
	if (arr.length < 1) {
		throw new Error(name + ' must have at least 1 element');
	}

	for (const element of arr) {
		if (typeof element !== 'number') {
			throw new Error(`${name} must contain only numbers`);
		}

		if (!Number.isFinite(element)) {
			throw new Error(
				`${name} must contain only finite numbers, but got [${arr.join(',')}]`,
			);
		}
	}
}

export function assertValidInterpolateEasingOption(
	easing: EasingFunction | readonly EasingFunction[] | undefined,
	inputRangeLength: number,

View on GitHub (pinned to 78fe4bb3fd)

Solutions

  1. Provide at least one element to both inputRange and outputRange.
  2. Guard the call site so interpolate() is skipped when the range array is empty.
  3. Default the array to a sensible single keyframe instead of [].

Example fix

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

Strategy: validation

Validate before calling

if (inputRange.length === 0 || outputRange.length === 0) {
  return; // nothing to interpolate
}
const r = interpolate(input, inputRange, outputRange);

Type guard

const isNonEmpty = (arr: readonly unknown[]): boolean => arr.length > 0;

Prevention

When it happens

Trigger: Calling interpolate() with inputRange = [] or outputRange = []; passing an array that was filtered down to nothing, e.g. keyframes.filter(k => k.active) when none are active.

Common situations: Dynamically building ranges from data that can be empty; conditional keyframe arrays that resolve to [] under some config; reading a range prop that was never populated.

Related errors


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