remotion-dev/remotion · error · Error
inputRange must contain only finite numbers, but got
Error message
inputRange must contain only finite numbers, but got [${arr.join(',')}] What it means
Thrown by checkInputRange when any element is positive or negative Infinity. interpolateStyles needs finite numbers to compute interpolation segments and locate the active range index, so infinite endpoints are rejected.
Solutions
- Clamp values to a finite bound with Math.min/Math.max before building the range.
- Guard divisors against zero before dividing.
- Run Number.isFinite() on every element and reject or clamp non-finite values.
Example fix
// before
interpolateStyles(frame, [0, Infinity], [{opacity: 1}, {opacity: 0}]);
// after
interpolateStyles(frame, [0, 30], [{opacity: 1}, {opacity: 0}]); Defensive patterns
Strategy: validation
Validate before calling
if (!inputRange.every((x) => Number.isFinite(x))) {
throw new Error('inputRange must contain only finite numbers');
} Type guard
const isAllFinite = (arr: number[]): boolean => arr.every((x) => Number.isFinite(x));
Prevention
- Guard divisors against zero before dividing to compute range endpoints.
- Clamp computed values with Math.min/Math.max to finite bounds.
- Run Number.isFinite() on every element of dynamically sourced ranges.
When it happens
Trigger: Passing [0, Infinity] or [-Infinity, 30]; a value derived from division by zero (1/0 === Infinity); an overflow from arithmetic on Number.MAX_VALUE.
Common situations: Computing a range endpoint from a ratio where the denominator is 0; reading JSON that contained Infinity (often serialized to null); unbounded calculations.
Related errors
- inputRange can not be undefined
- inputRange ( ) and outputStylesRange ( ) must have the same…
- inputRange must be strictly monotonically non-decreasing…
- inputRange must contain only numbers
- inputRange must have at least 2 elements
AI-assisted analysis of remotion-dev/remotion@78fe4bb3fd (2026-08-12).
Data as JSON: /api/errors/bcda51066a8785e3.
Report an issue: GitHub.
Appendix: source
Thrown at packages/animation-utils/src/transformation-helpers/interpolate-styles/index.tsx:242
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(
',',
)}]`,
);
}
}
}
function checkStylesRange(arr: readonly Style[]) {
if (arr.length < 2) {View on GitHub (pinned to 78fe4bb3fd)