{"record":{"id":"dc06e3349dfd6f88","repo":"remotion-dev/remotion","slug":"easing-i-must-be-a-function","errorCode":null,"errorMessage":"easing[${i}] must be a function","messagePattern":"easing\\[(.+?)\\] must be a function","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/core/src/interpolate.ts","lineNumber":1059,"sourceCode":") {\n\tif (easing === undefined) {\n\t\treturn;\n\t}\n\n\tif (typeof easing === 'function') {\n\t\treturn;\n\t}\n\n\tconst expectedLength = inputRangeLength - 1;\n\tif (easing.length !== expectedLength) {\n\t\tthrow new Error(\n\t\t\t`When easing is an array, it must have one entry per segment between keyframes (length inputRange.length - 1 = ${expectedLength}), but got length ${easing.length}`,\n\t\t);\n\t}\n\n\tfor (let i = 0; i < easing.length; i++) {\n\t\tif (typeof easing[i] !== 'function') {\n\t\t\tthrow new Error(`easing[${i}] must be a function`);\n\t\t}\n\t}\n}\n\nexport function assertValidInterpolatePosterizeOption(\n\tposterize: number | undefined,\n) {\n\tif (posterize === undefined) {\n\t\treturn;\n\t}\n\n\tif (\n\t\ttypeof posterize !== 'number' ||\n\t\t!Number.isFinite(posterize) ||\n\t\tposterize <= 0\n\t) {\n\t\tthrow new Error(\n\t\t\t`posterize must be a positive finite number, but got ${posterize}`,","sourceCodeStart":1041,"sourceCodeEnd":1077,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/core/src/interpolate.ts#L1041-L1077","documentation":"Thrown by assertValidInterpolateEasingOption while iterating the easing array. Each entry must be a function (an easing function); a non-function entry (number, string, null, undefined) is rejected.","triggerScenarios":"interpolate(t, [0,1], [0,100], {easing: ['easeIn']}); passing the name of an easing as a string instead of the function reference; an array like [Easing.linear, null, Easing.ease] with a gap.","commonSituations":"Confusing easing identifiers/names with the easing functions themselves; deserializing easing config from JSON (functions cannot be serialized) and passing the raw strings.","solutions":["Pass actual easing function references from the Easing module, not their names.","Map any serialized easing names to functions via a lookup table before calling interpolate().","Drop undefined/null entries from the easing array."],"exampleFix":"// before\nconst r = interpolate(t, [0, 1], [0, 100], {easing: ['easeIn']});\n// after\nimport {Easing} from 'remotion';\nconst r = interpolate(t, [0, 1], [0, 100], {easing: [Easing.in(Easing.ease)]});","handlingStrategy":"type-guard","validationCode":"if (Array.isArray(easing) && !easing.every((e) => typeof e === 'function')) {\n  throw new Error('every easing entry must be a function');\n}\nconst r = interpolate(input, inputRange, outputRange, {easing});","typeGuard":"const isEasingFunctionArray = (\n  e: unknown,\n): e is ((t: number) => number)[] =>\n  Array.isArray(e) && e.every((f) => typeof f === 'function');","tryCatchPattern":null,"preventionTips":["Import easing functions from the Easing module; never pass their names as strings.","Map serialized easing names to functions through a lookup table.","Drop null/undefined entries before building the easing array."],"tags":["interpolation","easing","type-error"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}