{"record":{"id":"41e4d60fee5a5424","repo":"remotion-dev/remotion","slug":"input-can-not-be-undefined-41e4d6","errorCode":null,"errorMessage":"input can not be undefined","messagePattern":"input can not be undefined","errorType":"exception","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"packages/core/src/interpolate-colors.ts","lineNumber":701,"sourceCode":"\t\t}\n\n\t\treturn Math.round(unrounded);\n\t});\n\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);","sourceCodeStart":683,"sourceCodeEnd":719,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/core/src/interpolate-colors.ts#L683-L719","documentation":"Thrown by interpolateColors when the `input` argument is undefined. This is a defensive guard because interpolateColors cannot map an absent input value to a color.","triggerScenarios":"Calling interpolateColors(undefined, inputRange, outputRange) — usually because the input was computed from an optional value that was not provided.","commonSituations":"Frame or progress value sourced from optional input props or a hook that returned undefined; destructuring that silently yielded undefined.","solutions":["Default the input: interpolateColors(input ?? 0, inputRange, outputRange).","Trace where input becomes undefined and fix the upstream computation.","Type the input source as number so the gap surfaces at compile time."],"exampleFix":"// before\nconst color = interpolateColors(progress, [0, 1], ['red', 'green']); // progress undefined\n\n// after\nconst color = interpolateColors(progress ?? 0, [0, 1], ['red', 'green']);","handlingStrategy":"type-guard","validationCode":"if (typeof input !== 'number' || Number.isNaN(input)) {\n  throw new TypeError('interpolateColors: input must be a number');\n}\ninterpolateColors(input, inputRange, outputRange);","typeGuard":"const isInterpInput = (v: unknown): v is number => typeof v === 'number' && !Number.isNaN(v);","tryCatchPattern":null,"preventionTips":["Default optional inputs: input ?? 0.","Type the input source as number.","Trace undefined inputs back to their origin."],"tags":["color","interpolate","validation","undefined"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}