remotion-dev/remotion · error · RangeError

"smoothness" must be between 0 and 1, but got ${r.smoothness

Error message

"smoothness" must be between 0 and 1, but got ${r.smoothness}

What it means

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.

Source

Thrown at packages/effects/src/starburst.ts:130

		);
	}

	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');
	}

	if (r.origin.some((coordinate) => coordinate < 0 || coordinate > 1)) {
		throw new RangeError(
			`"origin" must contain coordinates between 0 and 1, but got ${JSON.stringify(r.origin)}`,
		);

View on GitHub (pinned to 78fe4bb3fd)

Solutions

  1. Clamp smoothness to [0, 1] before calling starburst(): Math.min(1, Math.max(0, smoothness)).
  2. Constrain the upstream input (slider, schema) so it cannot produce out-of-range values.
  3. Default to 0 when the input is missing or invalid.
  4. Confirm you are passing a fraction (0–1), not a percentage (0–100).

Example fix

// before
starburst({ rays: 12, colors: ['#ff0000','#00ff00'], smoothness: 50 }); // 50 is a percentage, not a fraction

// after
const smoothness = Math.min(1, Math.max(0, inputPercent / 100));
starburst({ rays: 12, colors: ['#ff0000','#00ff00'], smoothness });
Defensive patterns

Strategy: validation

Validate before calling

function clampSmoothness(v: number): number {
  return Math.min(1, Math.max(0, v));
}

starburst({ rays, colors, smoothness: clampSmoothness(inputSmoothness) });

Type guard

function isValidSmoothness(v: unknown): v is number {
  return typeof v === 'number' && Number.isFinite(v) && v >= 0 && v <= 1;
}

Try / catch

try {
  starburst({ rays, colors, smoothness });
} catch (err) {
  if (err instanceof RangeError && /"smoothness" must be between 0 and 1/.test(err.message)) {
    const clamped = Math.min(1, Math.max(0, Number(smoothness)));
    starburst({ rays, colors, smoothness: clamped }); // retry with clamped value
    return;
  }
  throw err;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of remotion-dev/remotion@78fe4bb3fd (2026-08-12). Data as JSON: /api/errors/9088fbfa4e9290da. Report an issue: GitHub.