{"record":{"id":"484a955b989fc0ce","repo":"remotion-dev/remotion","slug":"name-must-be-a-finite-number-but-got-json","errorCode":null,"errorMessage":"\"${name}\" must be a finite number, but got ${JSON.stringify(value)}","messagePattern":"\"(.+?)\" must be a finite number, but got (.+?)","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"packages/effects/src/validate-effect-param.ts","lineNumber":17,"sourceCode":"export const assertEffectParamsObject = (\n\tparams: unknown,\n\teffectLabel: string,\n): void => {\n\tif (params === null || typeof params !== 'object') {\n\t\tthrow new TypeError(\n\t\t\t`${effectLabel} effect requires a parameters object, but got ${JSON.stringify(params)}`,\n\t\t);\n\t}\n};\n\nexport const assertRequiredFiniteNumber = (\n\tvalue: unknown,\n\tname: string,\n): void => {\n\tif (typeof value !== 'number' || !Number.isFinite(value)) {\n\t\tthrow new TypeError(\n\t\t\t`\"${name}\" must be a finite number, but got ${JSON.stringify(value)}`,\n\t\t);\n\t}\n};\n\nexport const assertRequiredColor = (value: unknown, name: string): void => {\n\tif (typeof value !== 'string' || value.length === 0) {\n\t\tthrow new TypeError(\n\t\t\t`\"${name}\" must be a non-empty string, but got ${JSON.stringify(value)}`,\n\t\t);\n\t}\n};\n\nexport const assertOptionalColor = (value: unknown, name: string): void => {\n\tif (value === undefined) {\n\t\treturn;\n\t}\n","sourceCodeStart":1,"sourceCodeEnd":35,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/effects/src/validate-effect-param.ts#L1-L35","documentation":"Thrown by assertRequiredFiniteNumber when a value is not a number, is NaN, or is Infinity/-Infinity. This validator is used by effects that mandate a numeric param with no default — currently the wave effect (wave/index.ts:82) and similar effects with required numeric fields. Number.isFinite rejects NaN and Infinity, so only true finite numbers pass.","triggerScenarios":"Calling an effect like wave with a missing or non-numeric required field (e.g. wave({}) when wave requires a number), or passing NaN/Infinity computed from bad math (e.g. 1/0, parseInt('abc'), parseFloat(undefined)).","commonSituations":"Param computed from user input that was not sanitized; division by zero producing Infinity; parseInt on a non-numeric string producing NaN; a required field was added to the effect type but existing call sites were not updated.","solutions":["Provide a finite number for the required field: wave({frequency: 2})","Sanitize computed values with Number.isFinite before passing them: effect({x: Number.isFinite(v) ? v : 0})","Guard parseFloat/parseInt results: if the source string is non-numeric, provide a fallback finite value","Check the effect's TypeScript type — the field will be marked as required (non-optional) number"],"exampleFix":"// before\nconst e = wave({frequency: NaN});\n\n// after\nconst freq = Number.isFinite(raw) ? raw : 1;\nconst e = wave({frequency: freq});","handlingStrategy":"validation","validationCode":"function isFiniteNumber(value: unknown): value is number {\n  return typeof value === 'number' && Number.isFinite(value);\n}\n\n// Before calling:\nif (!isFiniteNumber(params.frequency)) {\n  throw new Error('frequency must be a finite number');\n}\nconst e = wave(params);","typeGuard":"function isFiniteNumber(value: unknown): value is number {\n  return typeof value === 'number' && Number.isFinite(value);\n}","tryCatchPattern":null,"preventionTips":["Check Number.isFinite on computed numeric params before passing them to effects","Guard parseInt/parseFloat results — they return NaN for invalid input","Ensure division operations cannot produce Infinity (guard against division by zero)","Rely on the effect's TypeScript type: required numeric fields are non-optional number"],"tags":["validation","typescript","params","typeerror","nan","shared-helper"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}