{"record":{"id":"d34e3e6e9041f490","repo":"remotion-dev/remotion","slug":"input-can-not-be-undefined","errorCode":null,"errorMessage":"input can not be undefined","messagePattern":"input can not be undefined","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/animation-utils/src/transformation-helpers/interpolate-styles/index.tsx","lineNumber":282,"sourceCode":"\tfor (const index in arr) {\n\t\tif (typeof arr[index] !== 'object') {\n\t\t\tthrow new Error('outputStyles must contain only objects');\n\t\t}\n\t}\n}\n\n/*\n * @description A function that interpolates between two styles based on an input range.\n * @see [Documentation](https://remotion.dev/docs/animation-utils/interpolate-styles)\n */\nexport const interpolateStyles = (\n\tinput: number,\n\tinputRange: number[],\n\toutputStylesRange: Style[],\n\toptions?: InterpolateOptions,\n) => {\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 outputStylesRange === 'undefined') {\n\t\tthrow new Error('outputRange can not be undefined');\n\t}\n\n\tif (inputRange.length !== outputStylesRange.length) {\n\t\tthrow new Error(\n\t\t\t'inputRange (' +\n\t\t\t\tinputRange.length +\n\t\t\t\t') and outputStylesRange (' +\n\t\t\t\toutputStylesRange.length +\n\t\t\t\t') must have the same length',\n\t\t);","sourceCodeStart":264,"sourceCodeEnd":300,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/animation-utils/src/transformation-helpers/interpolate-styles/index.tsx#L264-L300","documentation":"Thrown at the top of interpolateStyles when the `input` argument is undefined. Although the TypeScript signature requires a number, this runtime guard catches callers that bypass types or pass an optional value that was never set.","triggerScenarios":"Calling interpolateStyles(undefined, range, styles); passing an optional frame variable from props/state that was never assigned.","commonSituations":"Using a value from props or state that may be undefined; a destructuring misconfiguration; calling before a frame value is initialized.","solutions":["Default the input to a finite number: interpolateStyles(input ?? 0, range, styles).","Validate the source of the frame value before calling (e.g. assert input != null).","Type the variable as number (not number | undefined) so the compiler flags the call site."],"exampleFix":"// before\ninterpolateStyles(maybeFrame, [0, 30], [{opacity: 1}, {opacity: 0}]);\n\n// after\ninterpolateStyles(maybeFrame ?? 0, [0, 30], [{opacity: 1}, {opacity: 0}]);","handlingStrategy":"validation","validationCode":"if (typeof input === 'undefined') {\n  input = 0; // or throw upstream\n}","typeGuard":"const isDefinedNumber = (v: unknown): v is number => typeof v === 'number';","tryCatchPattern":null,"preventionTips":["Type the input as number (not number | undefined) so the compiler flags the call site.","Default optional frame values with ?? 0 before calling interpolateStyles.","Initialize frame variables before the component body that calls interpolateStyles."],"tags":["interpolate-styles","validation","undefined"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}