remotion-dev/remotion · error · TypeError
"gamma" must be >= ${MIN_GAMMA}, but got ${JSON.stringify(ga
Error message
"gamma" must be >= ${MIN_GAMMA}, but got ${JSON.stringify(gamma)} What it means
Thrown by `levels()` when the resolved `gamma` falls below MIN_GAMMA (0.01). Gamma controls midtone brightness via a power curve; values at or near zero produce infinite/NaN output and effectively destroy the image, so the validator enforces a small positive floor.
Source
Thrown at packages/effects/src/levels.ts:99
const validateLevelsParams = (params: LevelsParams): void => {
assertEffectParamsObject(params, 'Levels');
assertOptionalFiniteNumber(params.blackPoint, 'blackPoint');
assertOptionalFiniteNumber(params.whitePoint, 'whitePoint');
assertOptionalFiniteNumber(params.gamma, 'gamma');
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;View on GitHub (pinned to 78fe4bb3fd)
Solutions
- Raise `gamma` to at least 0.01 (values near 0.01 are extremely contrasty; 1 is neutral).
- If animating, set `extrapolateLeft: 'clamp'` and an output range whose minimum is >= 0.01.
- Use the documented range 0.01–10 as a hard bound when deriving gamma from user input.
Example fix
// before
levels({gamma: 0})
// after
levels({gamma: 0.5}) Defensive patterns
Strategy: validation
Validate before calling
const MIN_GAMMA = 0.01;
if (typeof params.gamma === 'number' && params.gamma < MIN_GAMMA) {
params = {...params, gamma: MIN_GAMMA};
} Type guard
const isGammaInBounds = (g: number | undefined): boolean => g === undefined || (g >= 0.01 && g <= 10);
Prevention
- Treat 0.01–10 as a hard domain when building UI or animating gamma.
- Use `extrapolateLeft: 'clamp'` on any interpolate() that drives gamma.
- Floor user input at 0.01 before passing to levels().
When it happens
Trigger: Passing `levels({gamma: 0})`, `levels({gamma: 0.001})`, a negative gamma (also caught by `assertOptionalFiniteNumber` if non-finite), or animating gamma toward 0 with `interpolate()` whose output range dips below 0.01.
Common situations: Slider set to its visual minimum in Studio; keyframe animation extrapolating below the clamp; misreading the docs and assuming gamma can be 0 to 'crush' midtones.
Related errors
- "gamma" must be <= ${MAX_GAMMA}, but got ${JSON.stringify(ga
- "blackPoint" must be less than "whitePoint", but got ${JSON.
- "hueShift" must be >= 0, but got ${hueShift}
- "hueShift" must be <= 360, but got ${hueShift}
- "samples" must be an integer, but got ${samples}
AI-assisted analysis of remotion-dev/remotion@78fe4bb3fd (2026-08-12).
Data as JSON: /api/errors/c45823cde2a08af3.
Report an issue: GitHub.