remotion-dev/remotion · error · Error
input can not be undefined
Error message
input can not be undefined
What it means
Thrown at the top of the interpolate() implementation when the input argument is undefined. This is a dedicated guard before any range validation, because typeof undefined !== 'number' but the author wants a clearer message than the generic non-number error.
Source
Thrown at packages/core/src/interpolate.ts:1140
input: number,
inputRange: readonly number[],
outputRange: readonly (readonly number[])[],
options?: InterpolateOptions,
): number[];
export function interpolate(
input: number,
inputRange: readonly number[],
outputRange: readonly (number | string | readonly number[])[],
options?: InterpolateOptions,
): number | string | readonly number[];
export function interpolate(
input: number,
inputRange: readonly number[],
outputRange: readonly InterpolateOutputValue[],
options?: InterpolateOptions,
): number | string | readonly number[] {
if (typeof input === 'undefined') {
throw new Error('input can not be undefined');
}
if (typeof inputRange === 'undefined') {
throw new Error('inputRange can not be undefined');
}
if (typeof outputRange === 'undefined') {
throw new Error('outputRange can not be undefined');
}
if (inputRange.length !== outputRange.length) {
throw new Error(
'inputRange (' +
inputRange.length +
') and outputRange (' +
outputRange.length +
') must have the same length',
);View on GitHub (pinned to 78fe4bb3fd)
Solutions
- Ensure the input argument is a defined number before calling interpolate().
- Provide a sensible default value for the source variable.
- Skip the interpolation call when the input is not yet available.
Example fix
// before const r = interpolate(progress, [0, 1], [0, 100]); // progress is undefined // after const r = interpolate(progress ?? 0, [0, 1], [0, 100]);
Defensive patterns
Strategy: validation
Validate before calling
if (input === undefined) {
throw new Error('input is required');
}
const r = interpolate(input, inputRange, outputRange); Type guard
const isDefinedNumber = (v: unknown): v is number => typeof v === 'number';
Prevention
- Default the input variable with ?? 0 when it may be undefined.
- Type the input strictly as number in the function signature.
- Skip the interpolation call until the input value has loaded.
When it happens
Trigger: interpolate(undefined, [0,1], [0,100]); passing a variable that was never assigned; reading a missing field from an object, e.g. interpolate(obj.missing, [...], [...]).
Common situations: Destructuring a prop that does not exist; calling interpolate inside a component before the value prop has loaded; a defaulted parameter that resolved to undefined.
Related errors
- Cannot interpolate an input which is not a number
- outputRange tuples must contain only finite numbers, but got
- inputRange must be strictly monotonically increasing but got
- ${name} must have at least 1 element
- ${name} must contain only numbers
AI-assisted analysis of remotion-dev/remotion@78fe4bb3fd (2026-08-12).
Data as JSON: /api/errors/f3c1d90fd2bca60c.
Report an issue: GitHub.