remotion-dev/remotion · error

outputRange must contain only numbers

Error message

outputRange must contain only numbers

What it means

Thrown by interpolate() when outputRange is not an Array. The guard is `!Array.isArray(outputRange)`; the message ('must contain only numbers') is the user-facing intent but the actual check fires for any non-array value such as a bare number, string, or object passed where the outputRange array is expected.

Solutions

  1. Pass outputRange as an array literal, e.g. [0, 100].
  2. If the source is sometimes a scalar, wrap it: Array.isArray(x) ? x : [x].
  3. Verify the data shape returned by upstream code matches an array.

Example fix

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

Strategy: type-guard

Validate before calling

if (!Array.isArray(outputRange)) {
  throw new Error('outputRange must be an array');
}
const r = interpolate(input, inputRange, outputRange);

Type guard

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

Prevention

When it happens

Trigger: interpolate(0, [0,1], 100); interpolate(0, [0,1], '100'); interpolate(0,[0,1], {from:0,to:100}); passing a scalar instead of an array because a spread/unwrap was forgotten.

Common situations: Destructuring an array and passing a single element instead of the array; receiving a value from an API that returns a scalar instead of a list; refactoring that changed the shape of the data.

Related errors


AI-assisted analysis of remotion-dev/remotion@46a3a6bf13 (2026-09-18). Data as JSON: /api/errors/3c10ed309fc0442c. Report an issue: GitHub.

Appendix: source

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

				outputRange.length +
				') must have the same length',
		);
	}

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

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

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

	if (!Array.isArray(outputRange)) {
		throw new Error('outputRange must contain only numbers');
	}

	const outputType = options?.outputType;
	if (outputType === 'font-weight') {
		if (
			!outputRange.every(
				(output) => typeof output === 'number' || typeof output === 'string',
			)
		) {
			throw new TypeError(
				'Font weight outputRange must contain only numbers or strings',
			);
		}

		return interpolateFontWeight({
			input,
			inputRange,
			outputRange,

View on GitHub (pinned to 46a3a6bf13)