{"record":{"id":"9da1ecd64c39cf82","repo":"remotion-dev/remotion","slug":"cannot-interpolate-an-input-which-is-not-a-number","errorCode":null,"errorMessage":"Cannot interpolate an input which is not a number","messagePattern":"Cannot interpolate an input which is not a number","errorType":"exception","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"packages/core/src/interpolate.ts","lineNumber":1169,"sourceCode":"\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}\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);","sourceCodeStart":1151,"sourceCodeEnd":1187,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/core/src/interpolate.ts#L1151-L1187","documentation":"Thrown by interpolate() after the undefined check and range validation, when typeof input !== 'number'. Because undefined is already caught earlier, this fires for other non-number inputs: strings, booleans, objects, null, bigint, symbols, and functions. NaN does not hit this (typeof NaN === 'number') but is handled by extrapolation/clamping downstream.","triggerScenarios":"interpolate('0', [0,1], [0,100]); interpolate(null, [...], [...]); interpolate(true, [...], [...]); passing a frame value read from a string source without coercion.","commonSituations":"Reading the current value from a DOM input or URL param (string) and passing it uncoerced; passing an object that wraps a number; null from an optional chain.","solutions":["Coerce the input with Number() and confirm the result is a finite number.","Type the variable as number upstream so the bad value is caught at compile time.","Guard the call site to skip interpolation for non-number inputs."],"exampleFix":"// before\nconst r = interpolate(frameStr, [0, 1], [0, 100]); // frameStr is a string\n// after\nconst r = interpolate(Number(frameStr), [0, 1], [0, 100]);","handlingStrategy":"type-guard","validationCode":"if (typeof input !== 'number') {\n  throw new Error('input must be a number');\n}\nconst r = interpolate(input, inputRange, outputRange);","typeGuard":"const isNumber = (v: unknown): v is number => typeof v === 'number';","tryCatchPattern":null,"preventionTips":["Coerce string sources with Number() and check for NaN.","Type the input as number in component props and function signatures.","Guard the call site to skip interpolation for non-number inputs."],"tags":["interpolation","validation","type-error","input"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}