{"record":{"id":"3c10ed309fc0442c","repo":"remotion-dev/remotion","slug":"outputrange-must-contain-only-numbers","errorCode":null,"errorMessage":"outputRange must contain only numbers","messagePattern":"outputRange must contain only numbers","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/core/src/interpolate.ts","lineNumber":1173,"sourceCode":"\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}\n\n\tif (!Array.isArray(outputRange)) {\n\t\tthrow new Error('outputRange must contain only numbers');\n\t}\n\n\tconst hasStringOutput = outputRange.some(\n\t\t(output) => typeof output === 'string',\n\t);\n\tif (hasStringOutput) {\n\t\tif (\n\t\t\t!outputRange.every(\n\t\t\t\t(output) => typeof output === 'string' || typeof output === 'number',\n\t\t\t)\n\t\t) {\n\t\t\tthrow new TypeError(\n\t\t\t\t'outputRange must contain only numbers, or supported scale, translate, and rotate strings',\n\t\t\t);\n\t\t}\n\n\t\ttry {\n\t\t\treturn interpolateString({input, inputRange, outputRange, options});","sourceCodeStart":1155,"sourceCodeEnd":1191,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/core/src/interpolate.ts#L1155-L1191","documentation":"Thrown by interpolate() when outputRange is not an Array. The guard is `!Array.isArray(outputRange)`; the message ('must contain only numbers') is the user-facing intent but the actual check fires for any non-array value such as a bare number, string, or object passed where the outputRange array is expected.","triggerScenarios":"interpolate(0, [0,1], 100); interpolate(0, [0,1], '100'); interpolate(0,[0,1], {from:0,to:100}); passing a scalar instead of an array because a spread/unwrap was forgotten.","commonSituations":"Destructuring an array and passing a single element instead of the array; receiving a value from an API that returns a scalar instead of a list; refactoring that changed the shape of the data.","solutions":["Pass outputRange as an array literal, e.g. [0, 100].","If the source is sometimes a scalar, wrap it: Array.isArray(x) ? x : [x].","Verify the data shape returned by upstream code matches an array."],"exampleFix":"// before\nconst r = interpolate(t, [0, 1], 100);\n// after\nconst r = interpolate(t, [0, 1], [0, 100]);","handlingStrategy":"type-guard","validationCode":"if (!Array.isArray(outputRange)) {\n  throw new Error('outputRange must be an array');\n}\nconst r = interpolate(input, inputRange, outputRange);","typeGuard":"const isArray = (x: unknown): x is readonly unknown[] => Array.isArray(x);","tryCatchPattern":null,"preventionTips":["Always pass outputRange as an array literal.","Wrap scalars with Array.isArray(x) ? x : [x] when the source may be a single value.","Verify upstream data returns an array, not a scalar."],"tags":["interpolation","validation","output-range","type-error"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}