{"record":{"id":"42b0b7b1252eb2a1","repo":"remotion-dev/remotion","slug":"inputrange-inputrange-length-values-provided","errorCode":null,"errorMessage":"inputRange (${inputRange.length} values provided) and outputRange (${outputRange.length} values provided) must have the same length","messagePattern":"inputRange \\((.+?) values provided\\) and outputRange \\((.+?) values provided\\) must have the same length","errorType":"exception","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"packages/core/src/interpolate-colors.ts","lineNumber":713,"sourceCode":"\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\n\treturn interpolateColorsRGB(input, inputRange, processedOutputRange, options);\n};\n","sourceCodeStart":695,"sourceCodeEnd":726,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/core/src/interpolate-colors.ts#L695-L726","documentation":"Thrown by interpolateColors when inputRange and outputRange have different lengths. Interpolation pairs each input stop with an output color, so the two arrays must be the same length and ordered consistently.","triggerScenarios":"Passing arrays of mismatched length, e.g. interpolateColors(frame, [0, 50, 100], ['red', 'green']); or building one array dynamically while the other stays fixed.","commonSituations":"Adding a stop to one range and forgetting the other; generating ranges from different sources (e.g. a frames array vs. a palette array) that diverge in length.","solutions":["Align the two arrays so every input stop has a matching output color.","When generating dynamically, derive both from the same source: inputRange.map((_, i) => palette[i % palette.length]).","Assert inputRange.length === outputRange.length before the call."],"exampleFix":"// before\ninterpolateColors(frame, [0, 50, 100], ['red', 'green']);\n\n// after\ninterpolateColors(frame, [0, 50, 100], ['red', 'green', 'blue']);","handlingStrategy":"validation","validationCode":"if (inputRange.length !== outputRange.length) {\n  throw new TypeError(`Range length mismatch: ${inputRange.length} vs ${outputRange.length}`);\n}\ninterpolateColors(input, inputRange, outputRange);","typeGuard":"function rangesMatch(a: readonly unknown[], b: readonly unknown[]): boolean {\n  return a.length === b.length;\n}","tryCatchPattern":null,"preventionTips":["Derive both ranges from the same source so they stay aligned.","Add a length assertion before the call.","When adding a stop, update both arrays together."],"tags":["color","interpolate","validation","arrays"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}