remotion-dev/remotion · error · RangeError

"origin" must contain coordinates between 0 and 1, but got $

Error message

"origin" must contain coordinates between 0 and 1, but got ${JSON.stringify(r.origin)}

What it means

The starburst effect's `origin` coordinates must each fall within the closed interval [0, 1] (UV space). This RangeError is thrown by `validateStarburstEffectParams` after the tuple-shape check passes, when any coordinate is a finite number but lies outside [0, 1]. It fires during `validateParams`, ahead of GPU setup.

Source

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

	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)}`,
		);
	}

	for (const c of r.colors) {
		colorToRgb(c);
	}
};

const STARBURST_VS = /* glsl */ `#version 300 es
in vec2 aPos;
in vec2 aUv;
out vec2 vUv;
void main() {
	vUv = aUv;
	gl_Position = vec4(aPos, 0.0, 1.0);
}
`;

View on GitHub (pinned to 78fe4bb3fd)

Solutions

  1. Convert pixel coordinates to UV: divide x by canvas width and y by canvas height before passing as `origin`.
  2. Use values within [0, 1]; for the default center use `[0.5, 0.5]`.
  3. Clamp computed values with `Math.max(0, Math.min(1, value))` before assignment.

Example fix

// before - using pixel coordinates
starburst({rays: 6, colors: ['#f00', '#00f'], origin: [320, 180]});
// after - normalized to UV
starburst({rays: 6, colors: ['#f00', '#00f'], origin: [320/640, 180/360]});
Defensive patterns

Strategy: validation

Validate before calling

const clampUv = (v: number): number => Math.max(0, Math.min(1, v));
const rawOrigin = computeOriginPixels(); // [xPx, yPx]
const origin: [number, number] = [
  clampUv(rawOrigin[0] / canvasWidth),
  clampUv(rawOrigin[1] / canvasHeight),
];
starburst({rays: 6, colors: ['#f00', '#00f'], origin});

Type guard

const isUnitIntervalTuple = (v: readonly [number, number]): boolean =>
  v.every((c) => c >= 0 && c <= 1);

Try / catch

try {
  starburst({...params});
} catch (e) {
  if (e instanceof RangeError && /origin.*between 0 and 1/.test(e.message)) {
    starburst({...params, origin: [0.5, 0.5]});
  } else throw e;
}

Prevention

When it happens

Trigger: Passing `origin` with a coordinate below 0 or above 1 (e.g. `origin: [-0.1, 0.5]`, `origin: [0.5, 1.2]`, `origin: [2, 2]`). Confusing pixel coordinates with UV coordinates is the most common cause.

Common situations: Developer assumes origin is in pixels and passes large values like `[320, 180]`; computing origin from mouse/canvas pixel coordinates without normalizing by canvas dimensions; off-by-one in a normalization formula.

Related errors


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