{"record":{"id":"8704f64a2129d9fc","repo":"remotion-dev/remotion","slug":"name-must-be-1-but-got-json-stringify","errorCode":null,"errorMessage":"\"${name}\" must be >= -1, but got ${JSON.stringify(value)}","messagePattern":"\"(.+?)\" must be >= -1, but got (.+?)","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"packages/effects/src/color-utils.ts","lineNumber":82,"sourceCode":"\t\t\t`\"${name}\" must be <= 1, but got ${JSON.stringify(value)}`,\n\t\t);\n\t}\n};\n\nexport const validateNonNegative = (value: number, name: string): void => {\n\tif (value < 0) {\n\t\tthrow new TypeError(\n\t\t\t`\"${name}\" must be >= 0, but got ${JSON.stringify(value)}`,\n\t\t);\n\t}\n};\n\nexport const validateSignedUnitInterval = (\n\tvalue: number,\n\tname: string,\n): void => {\n\tif (value < -1) {\n\t\tthrow new TypeError(\n\t\t\t`\"${name}\" must be >= -1, but got ${JSON.stringify(value)}`,\n\t\t);\n\t}\n\n\tif (value > 1) {\n\t\tthrow new TypeError(\n\t\t\t`\"${name}\" must be <= 1, but got ${JSON.stringify(value)}`,\n\t\t);\n\t}\n};\n\nexport const clampColorChannel = (value: number): number => {\n\treturn Math.max(0, Math.min(255, value));\n};\n\nexport type ParsedColorRgba = readonly [number, number, number, number];\n\nexport const parseColorRgba = (","sourceCodeStart":64,"sourceCodeEnd":100,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/effects/src/color-utils.ts#L64-L100","documentation":"Thrown by validateSignedUnitInterval in @remotion/effects color-utils when a parameter constrained to the [-1, 1] range is given a value below -1. This guard protects signed-range parameters in effects like brightness (amount), colorCorrection (shadows, highlights, whites, blacks, temperature, tint, vibrance), and shadowsHighlights (shadows, highlights). The lower bound of -1 represents the extreme negative adjustment.","triggerScenarios":"Passing a value < -1 to brightness({amount: ...}), colorCorrection({shadows: ...}), colorCorrection({temperature: ...}), colorCorrection({vibrance: ...}), shadowsHighlights({shadows: ...}), or shadowsHighlights({highlights: ...}). For example brightness({amount: -1.5}) or colorCorrection({temperature: -2}).","commonSituations":"Using interpolate() with an outputRange that extends past -1 (e.g. [-2, 2]); confusing the signed unit-interval range [-1,1] with a non-negative multiplier range [0, inf); feeding a raw sine-wave oscillator output directly into a brightness amount without clamping; UI sliders with incorrect min attributes.","solutions":["Clamp the value to the [-1, 1] range before passing it: Math.max(-1, Math.min(1, value)).","If animating with interpolate(), constrain outputRange to stay within [-1, 1] (e.g. outputRange: [-1, 1]).","Check the parameter name in the error message to identify which signed-interval param overflowed.","Review the effect docs — brightness amount and colorCorrection tonal params use -1 for full negative effect, +1 for full positive."],"exampleFix":"// before\nbrightness({amount: Math.sin(t) * 2}) // can reach -2\n\n// after\nbrightness({amount: Math.max(-1, Math.min(1, Math.sin(t)))})","handlingStrategy":"validation","validationCode":"// Clamp to signed unit interval [-1, 1] before passing\nconst clamped = Math.max(-1, Math.min(1, value));\nbrightness({amount: clamped});","typeGuard":"const isSignedUnitInterval = (v: unknown): v is number =>\n  typeof v === 'number' && Number.isFinite(v) && v >= -1 && v <= 1;","tryCatchPattern":null,"preventionTips":["Constrain interpolate() outputRange to [-1, 1] for signed-interval params.","Apply Math.max(-1, Math.min(1, value)) to oscillator/computed values.","Remember brightness amount and colorCorrection tonal params use the -1..1 range.","Use the parameter name in the error to identify which value undershot -1."],"tags":["validation","effects","input-validation","color","signed-interval"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}