{"record":{"id":"b075e24388555a5b","repo":"remotion-dev/remotion","slug":"rays-must-be-between-2-and-100-but-got-rays","errorCode":null,"errorMessage":"\"rays\" must be between 2 and 100, but got ${rays}","messagePattern":"\"rays\" must be between 2 and 100, but got (.+?)","errorType":"validation","errorClass":"RangeError","httpStatus":null,"severity":"error","filePath":"packages/effects/src/starburst.ts","lineNumber":106,"sourceCode":"});\n\nconst validateStarburstEffectParams = (params: StarburstEffectParams): void => {\n\tif (params === null || typeof params !== 'object') {\n\t\tthrow new TypeError(\n\t\t\t`Starburst effect requires a parameters object, but got ${JSON.stringify(params)}`,\n\t\t);\n\t}\n\n\tconst {rays, colors} = params;\n\n\tif (typeof rays !== 'number' || !Number.isFinite(rays)) {\n\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(","sourceCodeStart":88,"sourceCodeEnd":124,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/effects/src/starburst.ts#L88-L124","documentation":"validateStarburstEffectParams() throws this RangeError when params.rays is a finite number but outside the supported [2, 100] range. The schema (starburstEffectSchema.rays) declares min 2 and max 100, and this check enforces it at runtime; fewer than 2 rays cannot form a starburst pattern and more than 100 over-subdivides the circle.","triggerScenarios":"Calling starburst({ rays: 1, colors }) (below minimum), starburst({ rays: 150, colors }) (above maximum), or passing a negative/fractional number that is finite. The finite-number guard (error 914) runs first, so only finite out-of-range values reach this check.","commonSituations":"A slider/input allowing values beyond 2–100; deriving rays from a formula without clamping; copying a value from another tool whose ray scale differs; accidentally passing a count meant for `colors`.","solutions":["Clamp rays to the [2, 100] range before calling starburst(), e.g. Math.min(100, Math.max(2, Math.round(rays))).","Constrain the upstream input (form field, schema) so it cannot produce out-of-range values.","Pick a sensible default within range (e.g. 12) when the input is missing or invalid.","Re-check the schema's min/max in starburstEffectSchema if you believe the limit should differ."],"exampleFix":"// before\nstarburst({ rays: 150, colors: ['#ff0000', '#00ff00'] });\nstarburst({ rays: 1, colors: ['#ff0000', '#00ff00'] });\n\n// after\nconst rays = Math.min(100, Math.max(2, Math.round(inputRays)));\nstarburst({ rays, colors: ['#ff0000', '#00ff00'] });","handlingStrategy":"validation","validationCode":"function clampRays(v: number): number {\n  return Math.min(100, Math.max(2, Math.round(v)));\n}\n\nstarburst({ rays: clampRays(inputRays), colors });","typeGuard":"function isValidRayCount(v: unknown): v is number {\n  return typeof v === 'number' && Number.isFinite(v) && v >= 2 && v <= 100;\n}","tryCatchPattern":"try {\n  starburst({ rays, colors });\n} catch (err) {\n  if (err instanceof RangeError && /\"rays\" must be between 2 and 100/.test(err.message)) {\n    const clamped = Math.min(100, Math.max(2, Math.round(Number(rays))));\n    starburst({ rays: clamped, colors }); // retry with clamped value\n    return;\n  }\n  throw err;\n}","preventionTips":["Clamp rays to [2, 100] before calling starburst().","Constrain sliders/inputs so they cannot exceed the range.","Provide a sensible default (e.g. 12) when input is missing.","Remember rays must be an integer count, not a continuous value."],"tags":["validation","effects","starburst","range","parameters"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}