{"record":{"id":"be67d4c0cf7ed32f","repo":"remotion-dev/remotion","slug":"name-must-be-1-but-got-json-stringify-v","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":63,"sourceCode":"\tvalue: unknown,\n\tname: string,\n): void => {\n\tif (value === undefined) {\n\t\treturn;\n\t}\n\n\tassertRequiredFiniteNumber(value, name);\n};\n\nexport const validateUnitInterval = (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\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 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) {","sourceCodeStart":45,"sourceCodeEnd":81,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/effects/src/color-utils.ts#L45-L81","documentation":"Thrown by validateUnitInterval in color-utils.ts when a value resolved to the [0,1] range exceeds 1. The dynamic name identifies the offending field: 'pivot' for color-correction, or 'similarity'/'smoothness'/'spillSuppression' for color-key. It is a caller-input TypeError.","triggerScenarios":"Reached when colorCorrection({pivot}) gets pivot > 1, or when colorKey({similarity | smoothness | spillSuppression}) gets a value > 1. Validation runs via validateUnitInterval at color-utils.ts:62 after the lower-bound check passes.","commonSituations":"Animated values from interpolate/Spring that overshoot above 1 without clamping, a value ported from another tool's scale, or a slider whose max exceeds 1.","solutions":["Clamp the value to [0,1]: Math.max(0, Math.min(1, value)).","Use interpolate(..., {extrapolateLeft: 'clamp', extrapolateRight: 'clamp'}) so animation cannot exceed the range.","Inspect the field name and value in the error and fix the source number.","Omit the field to use its documented default."],"exampleFix":"// before\ncolorCorrection({pivot: 1.4}); // throws: pivot must be <= 1\n\n// after\nconst pivot = Math.max(0, Math.min(1, animated));\ncolorCorrection({pivot});","handlingStrategy":"validation","validationCode":"function assertUnitInterval(value: number | undefined, name: string): number | undefined {\n  if (value === undefined) return value;\n  if (!Number.isFinite(value)) {\n    throw new TypeError(`${name} must be finite, got ${value}`);\n  }\n  if (value < 0 || value > 1) {\n    throw new TypeError(`${name} must be in [0, 1], got ${value}`);\n  }\n  return value;\n}\n\n// colorCorrection({pivot: assertUnitInterval(pivot, 'pivot')})\n// colorKey({\n//   similarity: assertUnitInterval(sim, 'similarity'),\n//   smoothness: assertUnitInterval(smooth, 'smoothness'),\n//   spillSuppression: assertUnitInterval(spill, 'spillSuppression'),\n// })","typeGuard":"const isUnitInterval = (v: unknown): v is number =>\n  typeof v === 'number' && Number.isFinite(v) && v >= 0 && v <= 1;","tryCatchPattern":null,"preventionTips":["Clamp values to [0,1] with Math.max(0, Math.min(1, value)) before passing them.","Use clamped interpolation for any value driving these fields.","Remember the field list: pivot (color-correction), similarity/smoothness/spillSuppression (color-key).","Omit a field to use its default rather than risk an over-1 value."],"tags":["validation","typescript","params","color-utils","unit-interval","color-key","color-correction"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}