remotion-dev/remotion · error · TypeError

"hueShift" must be >= 0, but got ${hueShift}

Error message

"hueShift" must be >= 0, but got ${hueShift}

What it means

Thrown by the `lightLeak()` effect's validator when the resolved `hueShift` is negative. Hue shift is measured in degrees on a [0, 360] hue wheel; a negative value has no defined meaning for the shader's hue rotation, so the validator rejects it.

Source

Thrown at packages/effects/src/light-leak.ts:68

	hueShift: number;
	progress: number;
};

const resolve = (p: LightLeakEffectParams): LightLeakResolved => ({
	seed: p.seed ?? DEFAULT_SEED,
	hueShift: p.hueShift ?? DEFAULT_HUE_SHIFT,
	progress: p.progress ?? DEFAULT_PROGRESS,
});

const validateLightLeakParams = (params: LightLeakEffectParams): void => {
	assertEffectParamsObject(params, 'lightLeak()');
	assertOptionalFiniteNumber(params.seed, 'seed');
	assertOptionalFiniteNumber(params.hueShift, 'hueShift');
	assertOptionalFiniteNumber(params.progress, 'progress');

	const {hueShift, progress} = resolve(params);
	if (hueShift < 0) {
		throw new TypeError(`"hueShift" must be >= 0, but got ${hueShift}`);
	}

	if (hueShift > 360) {
		throw new TypeError(`"hueShift" must be <= 360, but got ${hueShift}`);
	}

	validateUnitInterval(progress, 'progress');
};

const LIGHT_LEAK_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. Set `hueShift` to a value in [0, 360] (0 and 360 are equivalent).
  2. Clamp animated hueShift: `extrapolateLeft: 'clamp'` with an output minimum of 0.
  3. If you want a 'backward' rotation, use 360 - desiredOffset instead of a negative number.

Example fix

// before
lightLeak({hueShift: -45})

// after
lightLeak({hueShift: 315})
Defensive patterns

Strategy: validation

Validate before calling

if (typeof params.hueShift === 'number') {
  params = {...params, hueShift: Math.max(0, Math.min(360, params.hueShift))};
}

Type guard

const isHueShiftSafe = (h: number | undefined): boolean =>
  h === undefined || (h >= 0 && h <= 360);

Prevention

When it happens

Trigger: Passing `lightLeak({hueShift: -30})`, or animating hueShift with `interpolate()` whose output range dips below 0 without `extrapolateLeft: 'clamp'`.

Common situations: Slider dragged below zero in Studio; negative output from a math expression or easing that overshoots; user assuming hueShift wraps like a modulo.

Related errors


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