remotion-dev/remotion · error · Error

${name} must contain only finite numbers, but got [${arr.joi

Error message

${name} must contain only finite numbers, but got [${arr.join(',')}]

What it means

Thrown by checkInfiniteRange when inputRange or outputRange contains a number that is not finite — NaN, Infinity, or -Infinity. Finite math cannot interpolate to or from an infinite bound, so these are rejected even though typeof is 'number'.

Source

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

					',',
				)}]`,
			);
		}
	}
}

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,
) {
	if (easing === undefined) {
		return;
	}

	if (typeof easing === 'function') {
		return;
	}

View on GitHub (pinned to 78fe4bb3fd)

Solutions

  1. Replace NaN/Infinity with finite fallbacks (e.g. clamp to a large finite number) before calling interpolate().
  2. Trace the producer of the value (look for division, log, sqrt of negatives, parseInt of non-numeric strings).
  3. Filter the range with Number.isFinite() at build time and drop invalid entries.

Example fix

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

Strategy: validation

Validate before calling

const isAllFinite = (arr: readonly number[]) => arr.every(Number.isFinite);

if (!isAllFinite(inputRange) || !isAllFinite(outputRange)) {
  throw new Error('ranges must contain only finite numbers');
}
const r = interpolate(input, inputRange, outputRange);

Type guard

const isFiniteNumberArray = (arr: readonly unknown[]): arr is number[] =>
  arr.every((v) => typeof v === 'number' && Number.isFinite(v));

Prevention

When it happens

Trigger: interpolate(0, [0, Infinity], [0, 100]); interpolate(0, [0, 1], [0, NaN]); a range element computed from 1/0, Math.log(0), or parseFloat('abc').

Common situations: Division-by-zero in keyframe generation; parseFloat on malformed user input yielding NaN; math operations on undefined operands producing NaN.

Related errors


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