remotion-dev/remotion · error · TypeError

"gamma" must be <= ${MAX_GAMMA}, but got ${JSON.stringify(ga

Error message

"gamma" must be <= ${MAX_GAMMA}, but got ${JSON.stringify(gamma)}

What it means

Thrown by `levels()` when `gamma` exceeds MAX_GAMMA (10). Extremely large gamma values over-brighten midtones to the point of clipping the whole frame to white and offer no useful visual effect beyond the cap, so the validator rejects them.

Source

Thrown at packages/effects/src/levels.ts:105

	const {blackPoint, whitePoint, gamma} = resolve(params);
	validateUnitInterval(blackPoint, 'blackPoint');
	validateUnitInterval(whitePoint, 'whitePoint');

	if (blackPoint >= whitePoint) {
		throw new TypeError(
			`"blackPoint" must be less than "whitePoint", but got ${JSON.stringify(blackPoint)} and ${JSON.stringify(whitePoint)}`,
		);
	}

	if (gamma < MIN_GAMMA) {
		throw new TypeError(
			`"gamma" must be >= ${MIN_GAMMA}, but got ${JSON.stringify(gamma)}`,
		);
	}

	if (gamma > MAX_GAMMA) {
		throw new TypeError(
			`"gamma" must be <= ${MAX_GAMMA}, but got ${JSON.stringify(gamma)}`,
		);
	}
};

const VERTEX_SHADER = /* 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);
}
`;

const FRAGMENT_SHADER = /* glsl */ `#version 300 es
precision highp float;

View on GitHub (pinned to 78fe4bb3fd)

Solutions

  1. Lower `gamma` to <= 10 (10 is already an extreme wash-out).
  2. Clamp animated gamma with `extrapolateRight: 'clamp'` and an output max of 10.
  3. Re-derive the gamma multiplier so the product stays within 0.01–10.

Example fix

// before
levels({gamma: 25})

// after
levels({gamma: 2.2})
Defensive patterns

Strategy: validation

Validate before calling

const MAX_GAMMA = 10;
if (typeof params.gamma === 'number' && params.gamma > MAX_GAMMA) {
  params = {...params, gamma: MAX_GAMMA};
}

Type guard

const isGammaInBounds = (g: number | undefined): boolean =>
  g === undefined || (g >= 0.01 && g <= 10);

Prevention

When it happens

Trigger: Passing `levels({gamma: 50})` or any value > 10; animating gamma with an unclamped `interpolate()` whose output exceeds 10.

Common situations: Slider pushed to maximum; exponential/easing curves that overshoot; multiplying gamma by a scale factor that pushes it past 10.

Related errors


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