remotion-dev/remotion · error · Error
${name} must contain only numbers
Error message
${name} must contain only numbers What it means
Thrown by checkInfiniteRange when inputRange or outputRange contains an element whose typeof is not 'number'. Strings, booleans, objects, null, and undefined inside the 1-D numeric ranges are rejected before any interpolation math runs. The name in the message is the offending array ('inputRange' or 'outputRange').
Source
Thrown at packages/core/src/interpolate.ts:1027
for (let i = 1; i < arr.length; ++i) {
if (!(arr[i] > arr[i - 1])) {
throw new Error(
`inputRange must be strictly monotonically increasing but got [${arr.join(
',',
)}]`,
);
}
}
}
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;
}
View on GitHub (pinned to 78fe4bb3fd)
Solutions
- Coerce every element with Number() and verify none become NaN.
- Strip units and quotes from the source data before building the range.
- Type the range as number[] and let TypeScript flag non-number assignments.
Example fix
// before
const r = interpolate(t, [0, '1'], [0, 100]);
// after
const r = interpolate(t, [0, Number('1')], [0, 100]); Defensive patterns
Strategy: type-guard
Validate before calling
const isAllNumbers = (arr: readonly unknown[]): arr is number[] =>
arr.every((v) => typeof v === 'number');
if (!isAllNumbers(inputRange) || !isAllNumbers(outputRange)) {
throw new Error('ranges must contain only numbers');
}
const r = interpolate(input, inputRange, outputRange); Type guard
const isNumberArray = (arr: readonly unknown[]): arr is number[] => arr.every((v) => typeof v === 'number');
Prevention
- Type ranges as number[] so the compiler rejects non-number assignments.
- Coerce parsed JSON numbers with Number() and verify they are not NaN.
- Strip unit strings before inserting values into numeric ranges.
When it happens
Trigger: interpolate(0, [0, '1'], [0, 100]); interpolate(0, [0, 1], [0, null]); a range built from JSON-parsed values that arrived as strings; an array containing undefined from a sparse source.
Common situations: Parsing config/props as JSON where numbers deserialize as strings; mixing a string unit like '100px' into a numeric outputRange; optional fields rendered as undefined.
Related errors
- outputRange tuples must contain only finite numbers, but got
- Cannot interpolate an input which is not a number
- outputRange must contain only numbers
- outputRange must contain only numbers, numeric tuples, or su
- inputRange must be strictly monotonically increasing but got
AI-assisted analysis of remotion-dev/remotion@78fe4bb3fd (2026-08-12).
Data as JSON: /api/errors/65ab0f2cf72f140c.
Report an issue: GitHub.