{"record":{"id":"d47dcd57f42b27ac","repo":"remotion-dev/remotion","slug":"inputrange-can-not-be-undefined-d47dcd","errorCode":null,"errorMessage":"inputRange can not be undefined","messagePattern":"inputRange can not be undefined","errorType":"exception","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"packages/core/src/interpolate-colors.ts","lineNumber":705,"sourceCode":"\treturn rgbaColor(r, g, b, a);\n};\n\n/*\n * @description Allows you to map a range of values to colors using a concise syntax.\n * @see [Documentation](https://remotion.dev/docs/interpolate-colors)\n */\nexport const interpolateColors = (\n\tinput: number,\n\tinputRange: readonly number[],\n\toutputRange: readonly string[],\n\toptions?: InterpolateColorsOptions,\n): string => {\n\tif (typeof input === 'undefined') {\n\t\tthrow new TypeError('input can not be undefined');\n\t}\n\n\tif (typeof inputRange === 'undefined') {\n\t\tthrow new TypeError('inputRange can not be undefined');\n\t}\n\n\tif (typeof outputRange === 'undefined') {\n\t\tthrow new TypeError('outputRange can not be undefined');\n\t}\n\n\tif (inputRange.length !== outputRange.length) {\n\t\tthrow new TypeError(\n\t\t\t'inputRange (' +\n\t\t\t\tinputRange.length +\n\t\t\t\t' values provided) and outputRange (' +\n\t\t\t\toutputRange.length +\n\t\t\t\t' values provided) must have the same length',\n\t\t);\n\t}\n\n\tconst processedOutputRange = outputRange.map((c) => processColor(c));\n","sourceCodeStart":687,"sourceCodeEnd":723,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/core/src/interpolate-colors.ts#L687-L723","documentation":"Thrown by interpolateColors when the `inputRange` argument is undefined. The function needs an explicit input range to map from; omitting it is always a caller bug.","triggerScenarios":"Calling interpolateColors(input, undefined, outputRange), typically because inputRange was destructured from a missing field or built by a helper that returned undefined.","commonSituations":"Building the range dynamically (e.g. from a config that may be absent); copy-paste that left the second argument out.","solutions":["Pass an explicit inputRange array, e.g. [0, durationInFrames - 1].","Default it where it may be optional: inputRange ?? [0, 1].","Add a TypeScript type annotation so the missing argument is caught at compile time."],"exampleFix":"// before\ninterpolateColors(frame, range, colors); // range undefined\n\n// after\ninterpolateColors(frame, range ?? [0, 100], colors);","handlingStrategy":"type-guard","validationCode":"if (!Array.isArray(inputRange) || inputRange.length === 0) {\n  throw new TypeError('interpolateColors: inputRange must be a non-empty number[]');\n}\ninterpolateColors(input, inputRange, outputRange);","typeGuard":"const isNumberArray = (v: unknown): v is readonly number[] => Array.isArray(v) && v.every((n) => typeof n === 'number');","tryCatchPattern":null,"preventionTips":["Always pass an explicit inputRange array.","Default it where optional (inputRange ?? [0, 1]).","Annotate types so a missing argument fails at compile time."],"tags":["color","interpolate","validation","undefined"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}