{"record":{"id":"c45823cde2a08af3","repo":"remotion-dev/remotion","slug":"gamma-must-be-min-gamma-but-got-json-st","errorCode":null,"errorMessage":"\"gamma\" must be >= ${MIN_GAMMA}, but got ${JSON.stringify(gamma)}","messagePattern":"\"gamma\" must be >= (.+?), but got (.+?)","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"packages/effects/src/levels.ts","lineNumber":99,"sourceCode":"\nconst validateLevelsParams = (params: LevelsParams): void => {\n\tassertEffectParamsObject(params, 'Levels');\n\tassertOptionalFiniteNumber(params.blackPoint, 'blackPoint');\n\tassertOptionalFiniteNumber(params.whitePoint, 'whitePoint');\n\tassertOptionalFiniteNumber(params.gamma, 'gamma');\n\n\tconst {blackPoint, whitePoint, gamma} = resolve(params);\n\tvalidateUnitInterval(blackPoint, 'blackPoint');\n\tvalidateUnitInterval(whitePoint, 'whitePoint');\n\n\tif (blackPoint >= whitePoint) {\n\t\tthrow new TypeError(\n\t\t\t`\"blackPoint\" must be less than \"whitePoint\", but got ${JSON.stringify(blackPoint)} and ${JSON.stringify(whitePoint)}`,\n\t\t);\n\t}\n\n\tif (gamma < MIN_GAMMA) {\n\t\tthrow new TypeError(\n\t\t\t`\"gamma\" must be >= ${MIN_GAMMA}, but got ${JSON.stringify(gamma)}`,\n\t\t);\n\t}\n\n\tif (gamma > MAX_GAMMA) {\n\t\tthrow new TypeError(\n\t\t\t`\"gamma\" must be <= ${MAX_GAMMA}, but got ${JSON.stringify(gamma)}`,\n\t\t);\n\t}\n};\n\nconst VERTEX_SHADER = /* glsl */ `#version 300 es\nin vec2 aPos;\nin vec2 aUv;\nout vec2 vUv;\n\nvoid main() {\n\tvUv = aUv;","sourceCodeStart":81,"sourceCodeEnd":117,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/effects/src/levels.ts#L81-L117","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\nlevels({gamma: 0})\n\n// after\nlevels({gamma: 0.5})","handlingStrategy":"validation","validationCode":"const MIN_GAMMA = 0.01;\nif (typeof params.gamma === 'number' && params.gamma < MIN_GAMMA) {\n  params = {...params, gamma: MIN_GAMMA};\n}","typeGuard":"const isGammaInBounds = (g: number | undefined): boolean =>\n  g === undefined || (g >= 0.01 && g <= 10);","tryCatchPattern":null,"preventionTips":["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()."],"tags":["levels","validation","gamma","effect-params"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}