{"record":{"id":"9088fbfa4e9290da","repo":"remotion-dev/remotion","slug":"smoothness-must-be-between-0-and-1-but-got-r","errorCode":null,"errorMessage":"\"smoothness\" must be between 0 and 1, but got ${r.smoothness}","messagePattern":"\"smoothness\" must be between 0 and 1, but got (.+?)","errorType":"validation","errorClass":"RangeError","httpStatus":null,"severity":"error","filePath":"packages/effects/src/starburst.ts","lineNumber":130,"sourceCode":"\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');\n\t}\n\n\tif (r.origin.some((coordinate) => coordinate < 0 || coordinate > 1)) {\n\t\tthrow new RangeError(\n\t\t\t`\"origin\" must contain coordinates between 0 and 1, but got ${JSON.stringify(r.origin)}`,\n\t\t);","sourceCodeStart":112,"sourceCodeEnd":148,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/effects/src/starburst.ts#L112-L148","documentation":"validateStarburstEffectParams() throws this RangeError when smoothness is a finite number but outside the [0, 1] range. smoothness controls edge softness between rays as a fraction, so values below 0 or above 1 are meaningless; the schema (starburstEffectSchema.smoothness) declares min 0 and max 1 and this check enforces it at runtime.","triggerScenarios":"Calling starburst({ rays, colors, smoothness: 1.5 }) (above 1), smoothness: -0.2 (below 0), or any finite out-of-band value. The finite-number guard (error 918) runs first, so only finite out-of-range values reach this check.","commonSituations":"Passing a 0–100 percentage where a 0–1 fraction is expected; a slider allowing values beyond [0,1]; deriving smoothness from a formula without clamping; copying a value from another effect whose scale differs.","solutions":["Clamp smoothness to [0, 1] before calling starburst(): Math.min(1, Math.max(0, smoothness)).","Constrain the upstream input (slider, schema) so it cannot produce out-of-range values.","Default to 0 when the input is missing or invalid.","Confirm you are passing a fraction (0–1), not a percentage (0–100)."],"exampleFix":"// before\nstarburst({ rays: 12, colors: ['#ff0000','#00ff00'], smoothness: 50 }); // 50 is a percentage, not a fraction\n\n// after\nconst smoothness = Math.min(1, Math.max(0, inputPercent / 100));\nstarburst({ rays: 12, colors: ['#ff0000','#00ff00'], smoothness });","handlingStrategy":"validation","validationCode":"function clampSmoothness(v: number): number {\n  return Math.min(1, Math.max(0, v));\n}\n\nstarburst({ rays, colors, smoothness: clampSmoothness(inputSmoothness) });","typeGuard":"function isValidSmoothness(v: unknown): v is number {\n  return typeof v === 'number' && Number.isFinite(v) && v >= 0 && v <= 1;\n}","tryCatchPattern":"try {\n  starburst({ rays, colors, smoothness });\n} catch (err) {\n  if (err instanceof RangeError && /\"smoothness\" must be between 0 and 1/.test(err.message)) {\n    const clamped = Math.min(1, Math.max(0, Number(smoothness)));\n    starburst({ rays, colors, smoothness: clamped }); // retry with clamped value\n    return;\n  }\n  throw err;\n}","preventionTips":["Clamp smoothness to [0, 1] before calling starburst().","Constrain sliders so they cannot exceed the 0–1 band.","Default to 0 when input is missing or invalid.","Remember smoothness is a fraction (0–1), not a percentage (0–100)."],"tags":["validation","effects","starburst","range","parameters"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}