{"record":{"id":"a7b9c199ea644e77","repo":"remotion-dev/remotion","slug":"inputrange-can-not-be-undefined-a7b9c1","errorCode":null,"errorMessage":"inputRange can not be undefined","messagePattern":"inputRange can not be undefined","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/core/src/interpolate.ts","lineNumber":1144,"sourceCode":"): number[];\nexport function interpolate(\n\tinput: number,\n\tinputRange: readonly number[],\n\toutputRange: readonly (number | string | readonly number[])[],\n\toptions?: InterpolateOptions,\n): number | string | readonly number[];\nexport function interpolate(\n\tinput: number,\n\tinputRange: readonly number[],\n\toutputRange: readonly InterpolateOutputValue[],\n\toptions?: InterpolateOptions,\n): number | string | readonly number[] {\n\tif (typeof input === 'undefined') {\n\t\tthrow new Error('input can not be undefined');\n\t}\n\n\tif (typeof inputRange === 'undefined') {\n\t\tthrow new Error('inputRange can not be undefined');\n\t}\n\n\tif (typeof outputRange === 'undefined') {\n\t\tthrow new Error('outputRange can not be undefined');\n\t}\n\n\tif (inputRange.length !== outputRange.length) {\n\t\tthrow new Error(\n\t\t\t'inputRange (' +\n\t\t\t\tinputRange.length +\n\t\t\t\t') and outputRange (' +\n\t\t\t\toutputRange.length +\n\t\t\t\t') must have the same length',\n\t\t);\n\t}\n\n\tcheckInfiniteRange('inputRange', inputRange);\n\tcheckValidInputRange(inputRange);","sourceCodeStart":1126,"sourceCodeEnd":1162,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/core/src/interpolate.ts#L1126-L1162","documentation":"Thrown at the top of interpolate() when the inputRange argument is undefined. This is checked immediately after the input check, before any length or monotonicity validation, so you get a precise cause instead of a confusing 'cannot read length of undefined'.","triggerScenarios":"interpolate(0, undefined, [0,100]); passing a range variable that was never initialized; reading a missing array field from props/config.","commonSituations":"Forgetting to pass inputRange; conditionally building the range and hitting the branch that leaves it undefined; renaming a variable but not the call site.","solutions":["Always supply a defined inputRange array.","Default the variable to a valid range literal when it may be undefined.","Add a runtime guard that returns early when inputRange is missing."],"exampleFix":"// before\nconst r = interpolate(t, range, [0, 100]); // range is undefined\n// after\nconst r = interpolate(t, range ?? [0, 1], [0, 100]);","handlingStrategy":"validation","validationCode":"if (!Array.isArray(inputRange)) {\n  throw new Error('inputRange is required');\n}\nconst r = interpolate(input, inputRange, outputRange);","typeGuard":"const isNumberArray = (x: unknown): x is readonly number[] =>\n  Array.isArray(x) && x.every((v) => typeof v === 'number');","tryCatchPattern":null,"preventionTips":["Always pass inputRange as an array literal.","Default the variable to [0, 1] when it may be undefined.","Return early from the caller when inputRange is missing."],"tags":["interpolation","validation","input-range"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}