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
- Coerce and validate every element to a finite number before building the range.
- Filter out null/undefined entries: inputRange.filter((x) => typeof x === 'number').
- 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
- Type inputRange as number[] (not (number | undefined)[]) so the compiler flags bad elements.
- Filter out null/undefined before building the range.
- Validate parsed JSON values before using them as frame numbers.
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
- inputRange must have at least 2 elements
- inputRange must contain only finite numbers, but got [${arr.
- inputRange must be strictly monotonically non-decreasing but
- outputStyles must contain only objects
- inputRange can not be undefined
AI-assisted analysis of remotion-dev/remotion@78fe4bb3fd (2026-08-12).
Data as JSON: /api/errors/5d7701583a3f4364.
Report an issue: GitHub.