{"record":{"id":"cede53f47d9620cf","repo":"remotion-dev/remotion","slug":"outputrange-tuples-must-all-have-the-same-length","errorCode":null,"errorMessage":"outputRange tuples must all have the same length, but got ${dimensions} and ${output.length}","messagePattern":"outputRange tuples must all have the same length, but got (.+?) and (.+?)","errorType":"exception","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"packages/core/src/interpolate.ts","lineNumber":966,"sourceCode":"\t\t? outputRange[range + 1]\n\t\t: outputRange[range];\n};\n\nconst validateTupleOutputRange = (\n\toutputRange: readonly (readonly unknown[])[],\n): number => {\n\tconst dimensions = outputRange[0]?.length;\n\tif (dimensions === undefined) {\n\t\tthrow new Error('outputRange must have at least 1 element');\n\t}\n\n\tif (dimensions === 0) {\n\t\tthrow new TypeError('outputRange tuples must contain at least 1 number');\n\t}\n\n\tfor (const output of outputRange) {\n\t\tif (output.length !== dimensions) {\n\t\t\tthrow new TypeError(\n\t\t\t\t`outputRange tuples must all have the same length, but got ${dimensions} and ${output.length}`,\n\t\t\t);\n\t\t}\n\n\t\tfor (const value of output) {\n\t\t\tif (typeof value !== 'number' || !Number.isFinite(value)) {\n\t\t\t\tthrow new TypeError(\n\t\t\t\t\t`outputRange tuples must contain only finite numbers, but got [${output.join(\n\t\t\t\t\t\t',',\n\t\t\t\t\t)}]`,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\n\treturn dimensions;\n};\n","sourceCodeStart":948,"sourceCodeEnd":984,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/core/src/interpolate.ts#L948-L984","documentation":"Thrown by validateTupleOutputRange when outputRange tuples have differing lengths. The first tuple's length sets the expected dimensionality and every subsequent tuple must match it, because interpolateTuple interpolates axis-by-axis across all tuples.","triggerScenarios":"interpolate(t, [0, 1], [[0, 1], [2]]) (2 vs 1), [[0], [1, 2, 3]] (1 vs 3), or any ragged tuple outputRange.","commonSituations":"Conditionally pushing different numbers of values per keyframe; refactoring a tuple outputRange and forgetting to update every entry; off-by-one when zipping arrays.","solutions":["Pad or trim every tuple to the same length: [[0, 0], [2, 3]].","Validate tuple lengths against the first tuple before calling interpolate()."],"exampleFix":"// before\ninterpolate(t, [0, 1], [[0, 1], [2]]);\n// after\ninterpolate(t, [0, 1], [[0, 1], [2, 3]]);","handlingStrategy":"validation","validationCode":"const dims = (outputRange as readonly unknown[][])[0]?.length;\nif (!outputRange.every((t) => Array.isArray(t) && t.length === dims)) {\n  throw new Error(`All tuples must have length ${dims}`);\n}","typeGuard":"function isUniformTuples<T extends readonly number[]>(arr: readonly T[]): boolean {\n  const n = arr[0]?.length;\n  return n !== undefined && arr.every((t) => t.length === n);\n}","tryCatchPattern":null,"preventionTips":["Pad or trim tuples to a single shared length before calling interpolate().","Validate against the first tuple's length when assembling outputRange dynamically."],"tags":["interpolate","tuple","argument-shape","validation"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}