{"record":{"id":"df0cfc65c434cc4e","repo":"remotion-dev/remotion","slug":"inputrange-inputrange-length-and-outputrange","errorCode":null,"errorMessage":"inputRange (${inputRange.length}) and outputRange (${outputRange.length}) must have the same length","messagePattern":"inputRange \\((.+?)\\) and outputRange \\((.+?)\\) must have the same length","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/core/src/interpolate.ts","lineNumber":1152,"sourceCode":"\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);\n\n\tassertValidInterpolateEasingOption(options?.easing, inputRange.length);\n\tassertValidInterpolatePosterizeOption(options?.posterize);\n\tassertValidInterpolateOutputOption(options?.output);\n\n\tif (typeof input !== 'number') {\n\t\tthrow new TypeError('Cannot interpolate an input which is not a number');\n\t}","sourceCodeStart":1134,"sourceCodeEnd":1170,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/core/src/interpolate.ts#L1134-L1170","documentation":"Thrown by interpolate() when inputRange.length !== outputRange.length. Each input keyframe must map to exactly one output keyframe, so the two arrays must have the same number of elements; interpolation cannot proceed otherwise.","triggerScenarios":"interpolate(0, [0,1,2], [0,100]); adding a keyframe to one array but not the other; ranges built from different data sources whose lengths diverge.","commonSituations":"Editing keyframes and forgetting to keep both arrays in sync; copy-pasting a range and trimming one side; data-driven ranges where input and output come from mismatched lists.","solutions":["Make inputRange and outputRange the same length.","Build both arrays from a single keyframe definition so they stay in sync.","Read the counts in the error message to see which array is shorter/longer."],"exampleFix":"// before\nconst r = interpolate(t, [0, 1, 2], [0, 100]);\n// after\nconst r = interpolate(t, [0, 1, 2], [0, 50, 100]);","handlingStrategy":"validation","validationCode":"if (inputRange.length !== outputRange.length) {\n  throw new Error(`inputRange and outputRange lengths differ`);\n}\nconst r = interpolate(input, inputRange, outputRange);","typeGuard":"const sameLength = (\n  a: readonly unknown[],\n  b: readonly unknown[],\n): boolean => a.length === b.length;","tryCatchPattern":null,"preventionTips":["Derive inputRange and outputRange from a single keyframe list.","Add a unit test asserting length equality for data-driven ranges.","Re-check both arrays whenever you edit a keyframe."],"tags":["interpolation","validation","input-range","output-range"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}