{"record":{"id":"811ebc638e476cb2","repo":"remotion-dev/remotion","slug":"rotation-must-be-a-finite-number-but-got-json","errorCode":null,"errorMessage":"\"rotation\" must be a finite number, but got ${JSON.stringify(params.rotation)}","messagePattern":"\"rotation\" must be a finite number, but got (.+?)","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"packages/effects/src/starburst.ts","lineNumber":118,"sourceCode":"\t\tthrow new TypeError(\n\t\t\t`\"rays\" must be a finite number, but got ${JSON.stringify(rays)}`,\n\t\t);\n\t}\n\n\tif (rays < 2 || rays > 100) {\n\t\tthrow new RangeError(`\"rays\" must be between 2 and 100, but got ${rays}`);\n\t}\n\n\tif (!Array.isArray(colors) || colors.length < 2) {\n\t\tthrow new TypeError(\n\t\t\t`\"colors\" must be an array with at least 2 colors, but got ${JSON.stringify(colors)}`,\n\t\t);\n\t}\n\n\tconst r = resolve(params);\n\n\tif (typeof r.rotation !== 'number' || !Number.isFinite(r.rotation)) {\n\t\tthrow new TypeError(\n\t\t\t`\"rotation\" must be a finite number, but got ${JSON.stringify(params.rotation)}`,\n\t\t);\n\t}\n\n\tif (typeof r.smoothness !== 'number' || !Number.isFinite(r.smoothness)) {\n\t\tthrow new TypeError(\n\t\t\t`\"smoothness\" must be a finite number, but got ${JSON.stringify(params.smoothness)}`,\n\t\t);\n\t}\n\n\tif (r.smoothness < 0 || r.smoothness > 1) {\n\t\tthrow new RangeError(\n\t\t\t`\"smoothness\" must be between 0 and 1, but got ${r.smoothness}`,\n\t\t);\n\t}\n\n\tif (\n\t\t!Array.isArray(r.origin) ||","sourceCodeStart":100,"sourceCodeEnd":136,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/effects/src/starburst.ts#L100-L136","documentation":"validateStarburstEffectParams() throws this TypeError when rotation resolves to a non-finite value. rotation is optional with a default of 0 (see resolve()), so this only fires when the caller explicitly passes a non-number or non-finite number (NaN, Infinity) for rotation — the default never triggers it.","triggerScenarios":"Calling starburst({ rays, colors, rotation: NaN }), rotation: Infinity, or rotation: '45' (string). Because resolve() applies `?? 0`, omitting rotation is safe; only an explicitly bad value reaches this check.","commonSituations":"Feeding rotation from arithmetic that can yield NaN (e.g. parsing a malformed angle string with Number()); passing a string from a UI field without coercion; copying a value from a different unit/field; animation interpolation that produced NaN at a boundary.","solutions":["Pass a finite number for rotation, or omit it to use the default 0: starburst({ rays, colors }) or starburst({ rays, colors, rotation: 45 }).","If rotation comes from user input, coerce and validate with Number() + Number.isFinite before calling starburst().","Annotate the source variable as number in TypeScript so non-numbers are caught at compile time.","Audit interpolation/animation code for NaN at edge frames."],"exampleFix":"// before\nstarburst({ rays: 12, colors: ['#ff0000','#00ff00'], rotation: Number(inputAngle) }); // NaN if inputAngle is bad\n\n// after\nconst rotation = Number(inputAngle);\nstarburst({\n  rays: 12,\n  colors: ['#ff0000','#00ff00'],\n  rotation: Number.isFinite(rotation) ? rotation : 0,\n});","handlingStrategy":"validation","validationCode":"function resolveRotation(v: unknown): number {\n  if (v === undefined) return 0;\n  if (typeof v !== 'number' || !Number.isFinite(v)) {\n    throw new TypeError(`\"rotation\" must be a finite number, but got ${JSON.stringify(v)}`);\n  }\n  return v;\n}\n\nstarburst({ rays, colors, rotation: resolveRotation(input.rotation) });","typeGuard":"function isOptionalFiniteNumber(v: unknown): v is number | undefined {\n  return v === undefined || (typeof v === 'number' && Number.isFinite(v));\n}","tryCatchPattern":"try {\n  starburst({ rays, colors, rotation });\n} catch (err) {\n  if (err instanceof TypeError && /\"rotation\" must be a finite number/.test(err.message)) {\n    // rotation is optional — drop it and retry with the default of 0\n    starburst({ rays, colors });\n    return;\n  }\n  throw err;\n}","preventionTips":["Omit rotation to use the default 0, or pass a finite number.","Coerce untrusted input with Number() + Number.isFinite first.","Annotate rotation sources as number in TypeScript.","Audit interpolation code for NaN at boundary frames."],"tags":["validation","effects","starburst","typescript","parameters"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}