remotion-dev/remotion · error · Error

inputRange must contain only numbers

Error message

inputRange must contain only numbers

What it means

Thrown by checkInputRange when any element of inputRange is not of type 'number'. This includes null, undefined, NaN, and numeric-looking strings — none of them satisfy typeof === 'number', so the range is rejected.

Source

Thrown at packages/animation-utils/src/transformation-helpers/interpolate-styles/index.tsx:238

				[key]: Number(finalStyleValue),
			};
		}

		return {
			...acc,
			[key]: finalStyleValue,
		};
	}, {});
};

function checkInputRange(arr: readonly number[]) {
	if (arr.length < 2) {
		throw new Error('inputRange must have at least 2 elements');
	}

	for (let index = 0; index < arr.length; index++) {
		if (typeof arr[index] !== 'number') {
			throw new Error(`inputRange must contain only numbers`);
		}

		if (arr[index] === -Infinity || arr[index] === Infinity) {
			throw new Error(
				`inputRange must contain only finite numbers, but got [${arr.join(
					',',
				)}]`,
			);
		}

		if (index > 0 && !(arr[index] > arr[index - 1])) {
			throw new Error(
				`inputRange must be strictly monotonically non-decreasing but got [${arr.join(
					',',
				)}]`,
			);
		}
	}

View on GitHub (pinned to 78fe4bb3fd)

Solutions

  1. Coerce and validate every element to a finite number before building the range.
  2. Filter out null/undefined entries: inputRange.filter((x) => typeof x === 'number').
  3. Add Number.isFinite() checks for any dynamically sourced value.

Example fix

// before
interpolateStyles(frame, [0, null], [{opacity: 1}, {opacity: 0}]);

// after
interpolateStyles(frame, [0, 30], [{opacity: 1}, {opacity: 0}]);
Defensive patterns

Strategy: validation

Validate before calling

if (!inputRange.every((x) => typeof x === 'number')) {
  throw new Error('inputRange must contain only numbers');
}

Type guard

const isAllNumbers = (arr: unknown[]): arr is number[] =>
  arr.every((x) => typeof x === 'number' && !Number.isNaN(x));

Prevention

When it happens

Trigger: Passing inputRange like [0, undefined], [0, '30'], [null, 60], or [0, NaN] where NaN results from a failed Number('abc') conversion.

Common situations: Reading frame values from config that may be undefined; JSON parsing that yields nulls; arithmetic or parsing that produces NaN; sparse arrays with holes.

Related errors


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