remotion-dev/remotion · error · Error

inputRange can not be undefined

Error message

inputRange can not be undefined

What it means

Thrown at the top of interpolate() when the inputRange argument is undefined. This is checked immediately after the input check, before any length or monotonicity validation, so you get a precise cause instead of a confusing 'cannot read length of undefined'.

Source

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

): number[];
export function interpolate(
	input: number,
	inputRange: readonly number[],
	outputRange: readonly (number | string | readonly number[])[],
	options?: InterpolateOptions,
): number | string | readonly number[];
export function interpolate(
	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);

View on GitHub (pinned to 78fe4bb3fd)

Solutions

  1. Always supply a defined inputRange array.
  2. Default the variable to a valid range literal when it may be undefined.
  3. Add a runtime guard that returns early when inputRange is missing.

Example fix

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

Strategy: validation

Validate before calling

if (!Array.isArray(inputRange)) {
  throw new Error('inputRange is required');
}
const r = interpolate(input, inputRange, outputRange);

Type guard

const isNumberArray = (x: unknown): x is readonly number[] =>
  Array.isArray(x) && x.every((v) => typeof v === 'number');

Prevention

When it happens

Trigger: interpolate(0, undefined, [0,100]); passing a range variable that was never initialized; reading a missing array field from props/config.

Common situations: Forgetting to pass inputRange; conditionally building the range and hitting the branch that leaves it undefined; renaming a variable but not the call site.

Related errors


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