remotion-dev/remotion · error · Error
inputRange must be strictly monotonically non-decreasing but
Error message
inputRange must be strictly monotonically non-decreasing but got [${arr.join(',')}] What it means
Thrown by checkInputRange when the array is not strictly increasing. Each element must be greater than the previous one; equal or decreasing values are rejected because they create ambiguous or inverted interpolation segments. Note: the message says 'non-decreasing' but the check (arr[index] > arr[index - 1]) enforces strictly increasing — equal values also fail.
Source
Thrown at packages/animation-utils/src/transformation-helpers/interpolate-styles/index.tsx:250
if (arr.length < 2) {
throw new Error('inputRange must have at least 2 elements');
}
for (let index = 0; index < arr.length; index++) {
if (typeof arr[index] !== 'number') {
throw new Error(`inputRange must contain only numbers`);
}
if (arr[index] === -Infinity || arr[index] === Infinity) {
throw new Error(
`inputRange must contain only finite numbers, but got [${arr.join(
',',
)}]`,
);
}
if (index > 0 && !(arr[index] > arr[index - 1])) {
throw new Error(
`inputRange must be strictly monotonically non-decreasing but got [${arr.join(
',',
)}]`,
);
}
}
}
function checkStylesRange(arr: readonly Style[]) {
if (arr.length < 2) {
throw new Error('outputStyles must have at least 2 elements');
}
for (const index in arr) {
if (typeof arr[index] !== 'object') {
throw new Error('outputStyles must contain only objects');
}
}View on GitHub (pinned to 78fe4bb3fd)
Solutions
- Sort the range ascending and remove duplicates before calling interpolateStyles.
- Ensure each keyframe frame number is strictly greater than the previous one.
- Dedupe dynamic arrays with [...new Set(arr)].sort((a, b) => a - b).
Example fix
// before interpolateStyles(frame, [0, 10, 10, 30], [...]); // after interpolateStyles(frame, [0, 10, 30], [...]);
Defensive patterns
Strategy: validation
Validate before calling
const isStrictlyIncreasing = (arr: number[]): boolean =>
arr.every((x, i) => i === 0 || x > arr[i - 1]);
if (!isStrictlyIncreasing(inputRange)) {
// dedupe + sort
inputRange = [...new Set(inputRange)].sort((a, b) => a - b);
} Prevention
- Sort and dedupe dynamic ranges before calling interpolateStyles.
- Ensure keyframe frame numbers are strictly increasing when authoring.
- Remember the check is strictly increasing, despite the 'non-decreasing' wording.
When it happens
Trigger: Passing [0, 0], [30, 10], or [0, 10, 10, 20]; duplicate frame values from two keyframes at the same frame; a reversed keyframe order.
Common situations: Two keyframes sharing the same frame number; generating a range from unsorted data; copy-paste producing duplicates; rounding that collapses two distinct frames to the same integer.
Related errors
- inputRange must have at least 2 elements
- inputRange must contain only numbers
- inputRange must contain only finite numbers, but got [${arr.
- inputRange can not be undefined
- inputRange (${inputRange.length}) and outputStylesRange (${o
AI-assisted analysis of remotion-dev/remotion@78fe4bb3fd (2026-08-12).
Data as JSON: /api/errors/b70e49b5e838f7b6.
Report an issue: GitHub.