{"record":{"id":"5d7701583a3f4364","repo":"remotion-dev/remotion","slug":"inputrange-must-contain-only-numbers","errorCode":null,"errorMessage":"inputRange must contain only numbers","messagePattern":"inputRange must contain only numbers","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/animation-utils/src/transformation-helpers/interpolate-styles/index.tsx","lineNumber":238,"sourceCode":"\t\t\t\t[key]: Number(finalStyleValue),\n\t\t\t};\n\t\t}\n\n\t\treturn {\n\t\t\t...acc,\n\t\t\t[key]: finalStyleValue,\n\t\t};\n\t}, {});\n};\n\nfunction checkInputRange(arr: readonly number[]) {\n\tif (arr.length < 2) {\n\t\tthrow new Error('inputRange must have at least 2 elements');\n\t}\n\n\tfor (let index = 0; index < arr.length; index++) {\n\t\tif (typeof arr[index] !== 'number') {\n\t\t\tthrow new Error(`inputRange must contain only numbers`);\n\t\t}\n\n\t\tif (arr[index] === -Infinity || arr[index] === Infinity) {\n\t\t\tthrow new Error(\n\t\t\t\t`inputRange must contain only finite numbers, but got [${arr.join(\n\t\t\t\t\t',',\n\t\t\t\t)}]`,\n\t\t\t);\n\t\t}\n\n\t\tif (index > 0 && !(arr[index] > arr[index - 1])) {\n\t\t\tthrow new Error(\n\t\t\t\t`inputRange must be strictly monotonically non-decreasing but got [${arr.join(\n\t\t\t\t\t',',\n\t\t\t\t)}]`,\n\t\t\t);\n\t\t}\n\t}","sourceCodeStart":220,"sourceCodeEnd":256,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/animation-utils/src/transformation-helpers/interpolate-styles/index.tsx#L220-L256","documentation":"Thrown by checkInputRange when any element of inputRange is not of type 'number'. This includes null, undefined, NaN, and numeric-looking strings — none of them satisfy typeof === 'number', so the range is rejected.","triggerScenarios":"Passing inputRange like [0, undefined], [0, '30'], [null, 60], or [0, NaN] where NaN results from a failed Number('abc') conversion.","commonSituations":"Reading frame values from config that may be undefined; JSON parsing that yields nulls; arithmetic or parsing that produces NaN; sparse arrays with holes.","solutions":["Coerce and validate every element to a finite number before building the range.","Filter out null/undefined entries: inputRange.filter((x) => typeof x === 'number').","Add Number.isFinite() checks for any dynamically sourced value."],"exampleFix":"// before\ninterpolateStyles(frame, [0, null], [{opacity: 1}, {opacity: 0}]);\n\n// after\ninterpolateStyles(frame, [0, 30], [{opacity: 1}, {opacity: 0}]);","handlingStrategy":"validation","validationCode":"if (!inputRange.every((x) => typeof x === 'number')) {\n  throw new Error('inputRange must contain only numbers');\n}","typeGuard":"const isAllNumbers = (arr: unknown[]): arr is number[] =>\n  arr.every((x) => typeof x === 'number' && !Number.isNaN(x));","tryCatchPattern":null,"preventionTips":["Type inputRange as number[] (not (number | undefined)[]) so the compiler flags bad elements.","Filter out null/undefined before building the range.","Validate parsed JSON values before using them as frame numbers."],"tags":["interpolate-styles","input-range","validation","typescript"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}