{"record":{"id":"3963c857023a98fa","repo":"remotion-dev/remotion","slug":"argument-passed-to-api-for-param-param-i-3963c8","errorCode":null,"errorMessage":"Argument passed to \"${api}\" for param \"${param}\" is ${JSON.stringify(num)} (must be finite)","messagePattern":"Argument passed to \"(.+?)\" for param \"(.+?)\" is (.+?) \\(must be finite\\)","errorType":"exception","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"packages/animation-utils/src/transformation-helpers/make-transform/transform-functions.ts","lineNumber":41,"sourceCode":"\tparam: string;\n\tapi: string;\n}) => {\n\tif (typeof num === 'undefined') {\n\t\tthrow new TypeError(\n\t\t\t`Argument passed to \"${api}\" for param \"${param}\" is undefined`,\n\t\t);\n\t}\n\n\tif (typeof num !== 'number') {\n\t\tthrow new TypeError(\n\t\t\t`Argument passed to \"${api}\" for param \"${param}\" is ${JSON.stringify(\n\t\t\t\tnum,\n\t\t\t)}`,\n\t\t);\n\t}\n\n\tif (!Number.isFinite(num)) {\n\t\tthrow new TypeError(\n\t\t\t`Argument passed to \"${api}\" for param \"${param}\" is ${JSON.stringify(\n\t\t\t\tnum,\n\t\t\t)} (must be finite)`,\n\t\t);\n\t}\n};\n\nfunction matrix(\n\ta: number,\n\tb: number,\n\tc: number,\n\td: number,\n\ttx: number,\n\tty: number,\n): string {\n\tcheckNumber({num: a, param: 'a', api: 'matrix'});\n\tcheckNumber({num: b, param: 'b', api: 'matrix'});\n\tcheckNumber({num: c, param: 'c', api: 'matrix'});","sourceCodeStart":23,"sourceCodeEnd":59,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/animation-utils/src/transformation-helpers/make-transform/transform-functions.ts#L23-L59","documentation":"Third branch of `checkNumber`: the value is a `number` but fails `Number.isFinite`, i.e. it is `Infinity`, `-Infinity`, or `NaN`. The message appends `(must be finite)` and the serialized value. CSS transforms reject these values, so the helper refuses to emit them.","triggerScenarios":"Passing `Infinity` or `-Infinity` directly; passing `NaN` produced by `0/0`, `parseInt('abc')`, `Number(undefined)`, `Math.log(-1)`, or a failed `parseFloat`. Example: `translate(parseInt(userInput))` where the input is non-numeric yields `translate(NaN)`.","commonSituations":"Division by zero in animation math (`1 / duration` when duration is 0); `parseInt`/`parseFloat` on dirty user input that returns `NaN`; logarithmic or sqrt math on negative inputs; data feeds that occasionally deliver nulls that get coerced to 0 then divided.","solutions":["Find the arithmetic that produced the non-finite value (search for division, parseInt/parseFloat, Math.log/sqrt upstream of the call).","Sanitize with a guard: `const v = Number.isFinite(raw) ? raw : 0;` before calling the helper.","Validate parsed input: `const n = parseFloat(s); if (!Number.isFinite(n)) return fallback;`.","Clamp suspicious computed values with `Math.max/Math.min` bounds."],"exampleFix":"// before\nconst angle = Math.log(progress); // NaN if progress <= 0\nconst r = rotate(angle);\n\n// after\nconst angle = progress > 0 ? Math.log(progress) : 0;\nconst r = rotate(angle);","handlingStrategy":"validation","validationCode":"// Reject non-finite numbers before they reach a transform helper.\nconst finiteOr = (v: unknown, fallback: number): number =>\n  typeof v === 'number' && Number.isFinite(v) ? v : fallback;\n// usage: translate(finiteOr(parsedX, 0))","typeGuard":"const isFiniteNumber = (v: unknown): v is number =>\n  typeof v === 'number' && Number.isFinite(v);","tryCatchPattern":null,"preventionTips":["Validate the result of `parseInt`/`parseFloat` with `Number.isFinite` before animating.","Guard divisions: check the denominator is non-zero before dividing.","Clamp computed values (log/sqrt) to safe input ranges.","Add a sanity-check unit test for animation math with 0, negative, and null inputs."],"tags":["transform","validation","runtime","nan","infinity"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}