{"record":{"id":"ce3c151ac262ddf8","repo":"remotion-dev/remotion","slug":"argument-passed-to-api-for-param-param-i-ce3c15","errorCode":null,"errorMessage":"Argument passed to \"${api}\" for param \"${param}\" is ${JSON.stringify(num)}","messagePattern":"Argument passed to \"(.+?)\" for param \"(.+?)\" is (.+?)","errorType":"exception","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"packages/animation-utils/src/transformation-helpers/make-transform/transform-functions.ts","lineNumber":33,"sourceCode":"/* Matrix transformation */\n\nconst checkNumber = ({\n\tnum,\n\tparam,\n\tapi,\n}: {\n\tnum: unknown;\n\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,","sourceCodeStart":15,"sourceCodeEnd":51,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/animation-utils/src/transformation-helpers/make-transform/transform-functions.ts#L15-L51","documentation":"Second branch of `checkNumber`: the argument is defined but is not a `number` (e.g. a string that is not a unit string, a boolean, an object, null). The message embeds `JSON.stringify(num)` so the offending value is shown verbatim. It is a runtime guard for the `...args: unknown[]` implementation of every transform helper.","triggerScenarios":"Passing a non-numeric, non-unit value where a number is expected: `translate('abc')` (a plain string that fails `isUnitWithString`), `rotate(true)`, `scale(null)`, `skew({})`, or `perspective('5')` without a unit suffix. Also `translate(5, 'px')` is valid but `translate(5, 5)` is fine whereas `translate('5', 5)` fails the unit check.","commonSituations":"Treating the helpers like CSS string builders and passing raw CSS strings (`'10px'`) into a slot that expects a unit string in a different overload; untyped data from JSON/config where numbers arrive as strings; boolean coercion bugs (`translate(flag)`).","solutions":["Read the `JSON.stringify`-ed value in the message to see exactly what was passed, then convert it: `Number(value)` if it is a numeric string, or use the unit-string overload (`'10px'`) where supported.","For numeric strings from config, coerce explicitly before calling: `translate(Number(raw.x))`.","If you meant to pass a CSS unit string, switch to the overload that accepts it (e.g. `translate('10px')` instead of `translate(10, 'px')` mismatched with another number).","Add a typeof guard at the boundary that produces the value."],"exampleFix":"// before\nconst t = translate(rawX); // rawX is \"100\" from JSON\n\n// after\nconst t = translate(Number(rawX));","handlingStrategy":"type-guard","validationCode":"// Coerce or reject non-numbers before calling transform helpers.\nconst asTransformNumber = (v: unknown): number => {\n  if (typeof v === 'number') return v;\n  if (typeof v === 'string' && v.trim() !== '' && Number.isFinite(Number(v))) {\n    return Number(v);\n  }\n  throw new Error(`Expected a number, got ${JSON.stringify(v)}`);\n};\n// usage: translate(asTransformNumber(rawX))","typeGuard":"const isLengthUnitString = (v: unknown): v is string =>\n  typeof v === 'string' && /^-?\\d*\\.?\\d+(px|em|rem|vw|vh|%)$/.test(v);\n\nconst isTransformNumber = (v: unknown): v is number =>\n  typeof v === 'number' && Number.isFinite(v);","tryCatchPattern":null,"preventionTips":["Coerce numeric strings from JSON/forms with `Number(v)` before passing.","Do not pass raw CSS strings into number-only slots; use the unit-string overload instead.","Type transform arguments as `number` to surface type mismatches at compile time.","Unit-test transform calls with representative real data to catch type drift."],"tags":["transform","validation","runtime","type-coercion"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}