remotion-dev/remotion · error · Error
outputRange must contain only numbers
Error message
outputRange must contain only numbers
What it means
Thrown by interpolate() when outputRange is not an Array. The guard is `!Array.isArray(outputRange)`; the message ('must contain only numbers') is the user-facing intent but the actual check fires for any non-array value such as a bare number, string, or object passed where the outputRange array is expected.
Source
Thrown at packages/core/src/interpolate.ts:1173
') and outputRange (' +
outputRange.length +
') must have the same length',
);
}
checkInfiniteRange('inputRange', inputRange);
checkValidInputRange(inputRange);
assertValidInterpolateEasingOption(options?.easing, inputRange.length);
assertValidInterpolatePosterizeOption(options?.posterize);
assertValidInterpolateOutputOption(options?.output);
if (typeof input !== 'number') {
throw new TypeError('Cannot interpolate an input which is not a number');
}
if (!Array.isArray(outputRange)) {
throw new Error('outputRange must contain only numbers');
}
const hasStringOutput = outputRange.some(
(output) => typeof output === 'string',
);
if (hasStringOutput) {
if (
!outputRange.every(
(output) => typeof output === 'string' || typeof output === 'number',
)
) {
throw new TypeError(
'outputRange must contain only numbers, or supported scale, translate, and rotate strings',
);
}
try {
return interpolateString({input, inputRange, outputRange, options});View on GitHub (pinned to 78fe4bb3fd)
Solutions
- Pass outputRange as an array literal, e.g. [0, 100].
- If the source is sometimes a scalar, wrap it: Array.isArray(x) ? x : [x].
- Verify the data shape returned by upstream code matches an array.
Example fix
// before const r = interpolate(t, [0, 1], 100); // after const r = interpolate(t, [0, 1], [0, 100]);
Defensive patterns
Strategy: type-guard
Validate before calling
if (!Array.isArray(outputRange)) {
throw new Error('outputRange must be an array');
}
const r = interpolate(input, inputRange, outputRange); Type guard
const isArray = (x: unknown): x is readonly unknown[] => Array.isArray(x);
Prevention
- Always pass outputRange as an array literal.
- Wrap scalars with Array.isArray(x) ? x : [x] when the source may be a single value.
- Verify upstream data returns an array, not a scalar.
When it happens
Trigger: interpolate(0, [0,1], 100); interpolate(0, [0,1], '100'); interpolate(0,[0,1], {from:0,to:100}); passing a scalar instead of an array because a spread/unwrap was forgotten.
Common situations: Destructuring an array and passing a single element instead of the array; receiving a value from an API that returns a scalar instead of a list; refactoring that changed the shape of the data.
Related errors
- outputRange must contain only numbers, numeric tuples, or su
- 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/3c10ed309fc0442c.
Report an issue: GitHub.