{"record":{"id":"8212953cc590199f","repo":"remotion-dev/remotion","slug":"smoothness-must-be-a-finite-number-but-got-js","errorCode":null,"errorMessage":"\"smoothness\" must be a finite number, but got ${JSON.stringify(params.smoothness)}","messagePattern":"\"smoothness\" must be a finite number, but got (.+?)","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"packages/effects/src/starburst.ts","lineNumber":124,"sourceCode":"\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) ||\n\t\tr.origin.length !== 2 ||\n\t\tr.origin.some((coordinate) => {\n\t\t\treturn typeof coordinate !== 'number' || !Number.isFinite(coordinate);\n\t\t})\n\t) {\n\t\tthrow new TypeError('\"origin\" must be a [number, number] tuple');","sourceCodeStart":106,"sourceCodeEnd":142,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/effects/src/starburst.ts#L106-L142","documentation":"validateStarburstEffectParams() throws this TypeError when smoothness resolves to a non-finite value. smoothness is optional with a default of 0 (resolve() applies `?? 0`), so this fires only when the caller explicitly passes a non-number or non-finite number (NaN, Infinity). The subsequent range check (error 919) then enforces the [0,1] band.","triggerScenarios":"Calling starburst({ rays, colors, smoothness: NaN }), smoothness: Infinity, or smoothness: '0.5'. Omitting smoothness is safe (defaults to 0); only an explicitly bad value triggers this.","commonSituations":"Feeding smoothness from parsing/untrusted arithmetic that yields NaN; passing a string from a slider without coercion; copying a percentage (0–100) into a 0–1 field; animation producing NaN at a boundary.","solutions":["Pass a finite number in [0,1] for smoothness, or omit it for the default 0.","If smoothness comes from user input, coerce (Number()) and check Number.isFinite before calling starburst().","Annotate the source as number in TypeScript to catch non-numbers at compile time.","Confirm the value is a 0–1 fraction, not a 0–100 percentage."],"exampleFix":"// before\nstarburst({ rays: 12, colors: ['#ff0000','#00ff00'], smoothness: '50' });\n\n// after\nstarburst({ rays: 12, colors: ['#ff0000','#00ff00'], smoothness: 0.5 });","handlingStrategy":"validation","validationCode":"function resolveSmoothness(v: unknown): number {\n  if (v === undefined) return 0;\n  if (typeof v !== 'number' || !Number.isFinite(v)) {\n    throw new TypeError(`\"smoothness\" must be a finite number, but got ${JSON.stringify(v)}`);\n  }\n  return v;\n}\n\nstarburst({ rays, colors, smoothness: resolveSmoothness(input.smoothness) });","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, smoothness });\n} catch (err) {\n  if (err instanceof TypeError && /\"smoothness\" must be a finite number/.test(err.message)) {\n    // smoothness is optional — drop it and retry with the default of 0\n    starburst({ rays, colors });\n    return;\n  }\n  throw err;\n}","preventionTips":["Omit smoothness to use the default 0, or pass a finite number in [0,1].","Coerce untrusted input with Number() + Number.isFinite before calling starburst().","Confirm the value is a 0–1 fraction, not a 0–100 percentage.","Annotate smoothness sources as number in TypeScript."],"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"}