remotion-dev/remotion · error · Error
inputRange must be strictly monotonically increasing but got
Error message
inputRange must be strictly monotonically increasing but got [${arr.join(',')}] What it means
Thrown by checkValidInputRange. The inputRange for interpolate() must be strictly monotonically increasing: each value must be greater than the previous one. Equal adjacent values and any decrease both trigger it, because interpolation cannot resolve a segment with zero or negative width.
Source
Thrown at packages/core/src/interpolate.ts:1011
outputRange: readonly (readonly unknown[])[];
options: InterpolateOptions | undefined;
}): number[] => {
const dimensions = validateTupleOutputRange(outputRange);
return new Array(dimensions).fill(true).map((_, axis) =>
interpolateNumber({
input,
inputRange,
outputRange: outputRange.map((output) => output[axis] as number),
options,
}),
);
};
function checkValidInputRange(arr: readonly number[]) {
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`);
}
View on GitHub (pinned to 78fe4bb3fd)
Solutions
- Sort the inputRange ascending and dedupe it before calling interpolate().
- Inspect the rendered array in the error message ([${arr.join(',')}]) to find the duplicate/decrease.
- Regenerate keyframes so each timestamp is strictly greater than the prior one.
Example fix
// before const r = interpolate(t, [0, 0, 1], [0, 50, 100]); // after const r = interpolate(t, [0, 1], [0, 100]);
Defensive patterns
Strategy: validation
Validate before calling
const isStrictlyIncreasing = (arr: readonly number[]) =>
arr.every((v, i) => i === 0 || v > arr[i - 1]);
if (!isStrictlyIncreasing(inputRange)) {
throw new Error('inputRange must be strictly increasing');
}
const r = interpolate(input, inputRange, outputRange); Type guard
const isStrictlyIncreasing = (arr: readonly number[]): boolean => arr.every((v, i) => i === 0 || v > arr[i - 1]);
Prevention
- Sort and dedupe keyframe times before building inputRange.
- Keep keyframes in a single source-of-truth array so inputRange stays in sync.
- Add a unit test asserting monotonicity for data-driven ranges.
When it happens
Trigger: Passing inputRange with duplicate values, e.g. interpolate(0, [0, 0, 1], [...]); a decreasing range like [1, 0]; or an unsorted array built from a Set/Map whose insertion order is not ascending.
Common situations: Deriving keyframes from data (CSV, JSON, props) without sorting; copy-paste keyframes that reuse the same timestamp; rounding that collapses two distinct times to the same number.
Related errors
- ${name} must have at least 1 element
- inputRange can not be undefined
- inputRange (${inputRange.length}) and outputRange (${outputR
- inputRange must have at least 2 elements
- inputRange must contain only numbers
AI-assisted analysis of remotion-dev/remotion@78fe4bb3fd (2026-08-12).
Data as JSON: /api/errors/e6255930afaa666f.
Report an issue: GitHub.