remotion-dev/remotion · error · TypeError
outputRange must contain only numbers, numeric tuples, or su
Error message
outputRange must contain only numbers, numeric tuples, or supported scale, translate, and rotate strings
What it means
Thrown by interpolate() as the final fallback. After the string branch (no strings present) and the tuple branch (not all elements are arrays) are skipped, every remaining output must be a number; if any element is neither a number, a string, nor an array, this TypeError fires. It is the catch-all for outputRange contents the function cannot interpolate.
Source
Thrown at packages/core/src/interpolate.ts:1223
if (!hasNonNumericString) {
throw error;
}
return interpolateDiscreteString({
input,
inputRange,
outputRange,
options,
});
}
}
if (outputRange.every((output) => Array.isArray(output))) {
return interpolateTuple({input, inputRange, outputRange, options});
}
if (!outputRange.every((output) => typeof output === 'number')) {
throw new TypeError(
'outputRange must contain only numbers, numeric tuples, or supported scale, translate, and rotate strings',
);
}
checkInfiniteRange('outputRange', outputRange);
return interpolateNumber({input, inputRange, outputRange, options});
}
/* eslint-enable no-redeclare */
View on GitHub (pinned to 78fe4bb3fd)
Solutions
- Ensure outputRange contains only numbers (or only strings, or only tuples).
- Map the array to coerce/replace non-numeric values before calling interpolate().
- Filter out null/undefined entries so the array is homogeneous.
Example fix
// before const r = interpolate(t, [0, 1], [0, maybeAngle]); // maybeAngle can be null // after const r = interpolate(t, [0, 1], [0, maybeAngle ?? 0]);
Defensive patterns
Strategy: validation
Validate before calling
const allNum = outputRange.every((o) => typeof o === 'number');
const allStr = outputRange.every((o) => typeof o === 'string');
const allArr = outputRange.every((o) => Array.isArray(o));
if (!(allNum || allStr || allArr)) {
throw new Error('outputRange must be homogeneous');
}
const r = interpolate(input, inputRange, outputRange); Type guard
const isHomogeneousRange = (x: unknown[]): boolean => {
const allNum = x.every((o) => typeof o === 'number');
const allStr = x.every((o) => typeof o === 'string');
const allArr = x.every((o) => Array.isArray(o));
return allNum || allStr || allArr;
}; Prevention
- Keep outputRange homogeneous: all numbers, all strings, or all tuples.
- Filter null/undefined out of the array before the call.
- Type the range to a single element kind so mismatches surface at compile time.
When it happens
Trigger: interpolate(0,[0,1],[0, true]); interpolate(0,[0,1],[0, null]); interpolate(0,[0,1],[0, {x:1}]); a mixed array of numbers and booleans/objects.
Common situations: A conditional that injects a boolean into the array; an optional value rendered as null; partial data producing objects instead of numbers.
Related errors
- outputRange must contain only numbers
- outputRange tuples must contain only finite numbers, but got
- ${name} must have at least 1 element
- ${name} must contain only numbers
- outputRange can not be undefined
AI-assisted analysis of remotion-dev/remotion@78fe4bb3fd (2026-08-12).
Data as JSON: /api/errors/cc984c94021fbabf.
Report an issue: GitHub.