{"record":{"id":"bcda51066a8785e3","repo":"remotion-dev/remotion","slug":"inputrange-must-contain-only-finite-numbers-but-g","errorCode":null,"errorMessage":"inputRange must contain only finite numbers, but got [${arr.join(',')}]","messagePattern":"inputRange must contain only finite numbers, but got \\[(.+?)\\]","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/animation-utils/src/transformation-helpers/interpolate-styles/index.tsx","lineNumber":242,"sourceCode":"\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}\n}\n\nfunction checkStylesRange(arr: readonly Style[]) {\n\tif (arr.length < 2) {","sourceCodeStart":224,"sourceCodeEnd":260,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/animation-utils/src/transformation-helpers/interpolate-styles/index.tsx#L224-L260","documentation":"Thrown by checkInputRange when any element is positive or negative Infinity. interpolateStyles needs finite numbers to compute interpolation segments and locate the active range index, so infinite endpoints are rejected.","triggerScenarios":"Passing [0, Infinity] or [-Infinity, 30]; a value derived from division by zero (1/0 === Infinity); an overflow from arithmetic on Number.MAX_VALUE.","commonSituations":"Computing a range endpoint from a ratio where the denominator is 0; reading JSON that contained Infinity (often serialized to null); unbounded calculations.","solutions":["Clamp values to a finite bound with Math.min/Math.max before building the range.","Guard divisors against zero before dividing.","Run Number.isFinite() on every element and reject or clamp non-finite values."],"exampleFix":"// before\ninterpolateStyles(frame, [0, Infinity], [{opacity: 1}, {opacity: 0}]);\n\n// after\ninterpolateStyles(frame, [0, 30], [{opacity: 1}, {opacity: 0}]);","handlingStrategy":"validation","validationCode":"if (!inputRange.every((x) => Number.isFinite(x))) {\n  throw new Error('inputRange must contain only finite numbers');\n}","typeGuard":"const isAllFinite = (arr: number[]): boolean => arr.every((x) => Number.isFinite(x));","tryCatchPattern":null,"preventionTips":["Guard divisors against zero before dividing to compute range endpoints.","Clamp computed values with Math.min/Math.max to finite bounds.","Run Number.isFinite() on every element of dynamically sourced ranges."],"tags":["interpolate-styles","input-range","validation","math"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}