remotion-dev/remotion · error · TypeError
"smoothness" must be a finite number, but got ${JSON.stringi
Error message
"smoothness" must be a finite number, but got ${JSON.stringify(params.smoothness)} What it means
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.
Source
Thrown at packages/effects/src/starburst.ts:124
throw new RangeError(`"rays" must be between 2 and 100, but got ${rays}`);
}
if (!Array.isArray(colors) || colors.length < 2) {
throw new TypeError(
`"colors" must be an array with at least 2 colors, but got ${JSON.stringify(colors)}`,
);
}
const r = resolve(params);
if (typeof r.rotation !== 'number' || !Number.isFinite(r.rotation)) {
throw new TypeError(
`"rotation" must be a finite number, but got ${JSON.stringify(params.rotation)}`,
);
}
if (typeof r.smoothness !== 'number' || !Number.isFinite(r.smoothness)) {
throw new TypeError(
`"smoothness" must be a finite number, but got ${JSON.stringify(params.smoothness)}`,
);
}
if (r.smoothness < 0 || r.smoothness > 1) {
throw new RangeError(
`"smoothness" must be between 0 and 1, but got ${r.smoothness}`,
);
}
if (
!Array.isArray(r.origin) ||
r.origin.length !== 2 ||
r.origin.some((coordinate) => {
return typeof coordinate !== 'number' || !Number.isFinite(coordinate);
})
) {
throw new TypeError('"origin" must be a [number, number] tuple');View on GitHub (pinned to 78fe4bb3fd)
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.
Example fix
// before
starburst({ rays: 12, colors: ['#ff0000','#00ff00'], smoothness: '50' });
// after
starburst({ rays: 12, colors: ['#ff0000','#00ff00'], smoothness: 0.5 }); Defensive patterns
Strategy: validation
Validate before calling
function resolveSmoothness(v: unknown): number {
if (v === undefined) return 0;
if (typeof v !== 'number' || !Number.isFinite(v)) {
throw new TypeError(`"smoothness" must be a finite number, but got ${JSON.stringify(v)}`);
}
return v;
}
starburst({ rays, colors, smoothness: resolveSmoothness(input.smoothness) }); Type guard
function isOptionalFiniteNumber(v: unknown): v is number | undefined {
return v === undefined || (typeof v === 'number' && Number.isFinite(v));
} Try / catch
try {
starburst({ rays, colors, smoothness });
} catch (err) {
if (err instanceof TypeError && /"smoothness" must be a finite number/.test(err.message)) {
// smoothness is optional — drop it and retry with the default of 0
starburst({ rays, colors });
return;
}
throw err;
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Starburst effect requires a parameters object, but got ${JSO
- "rays" must be a finite number, but got ${JSON.stringify(ray
- "colors" must be an array with at least 2 colors, but got ${
- "rotation" must be a finite number, but got ${JSON.stringify
- "rays" must be between 2 and 100, but got ${rays}
AI-assisted analysis of remotion-dev/remotion@78fe4bb3fd (2026-08-12).
Data as JSON: /api/errors/8212953cc590199f.
Report an issue: GitHub.