remotion-dev/remotion · error · Error

outputRange can not be undefined

Error message

outputRange can not be undefined

What it means

Thrown at the top of interpolate() when the outputRange argument is undefined. Checked right after the inputRange guard, before length comparison, so the failure points clearly at the missing outputRange rather than at a downstream null-deref.

Source

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

	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);

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

View on GitHub (pinned to 78fe4bb3fd)

Solutions

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

Example fix

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

Strategy: validation

Validate before calling

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

Type guard

const isOutputArray = (x: unknown): x is readonly unknown[] =>
  Array.isArray(x);

Prevention

When it happens

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

Common situations: Forgetting to pass outputRange; building it conditionally and hitting the empty branch; destructuring a prop that does not exist.

Related errors


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