{"record":{"id":"d5c24198918ece7c","repo":"remotion-dev/remotion","slug":"name-must-be-between-min-and-max","errorCode":null,"errorMessage":"\"${name}\" must be between ${min} and ${max}","messagePattern":"\"(.+?)\" must be between (.+?) and (.+?)","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"packages/brand/src/effects/metallic-swirl-effect.ts","lineNumber":292,"sourceCode":"\tname: keyof MetallicSwirlParams,\n): void => {\n\tif (value === undefined) {\n\t\treturn;\n\t}\n\n\tif (typeof value !== 'number' || !Number.isFinite(value)) {\n\t\tthrow new TypeError(`\"${name}\" must be a finite number`);\n\t}\n};\n\nconst validateRange = (\n\tvalue: number,\n\tname: keyof MetallicSwirlParams,\n\tmin: number,\n\tmax: number,\n): void => {\n\tif (value < min || value > max) {\n\t\tthrow new TypeError(`\"${name}\" must be between ${min} and ${max}`);\n\t}\n};\n\nconst assertOptionalEnum = <T extends string>(\n\tvalue: unknown,\n\tname: keyof MetallicSwirlParams,\n\tvariants: readonly T[],\n): void => {\n\tif (value === undefined) {\n\t\treturn;\n\t}\n\n\tif (typeof value !== 'string' || !variants.includes(value as T)) {\n\t\tthrow new TypeError(`\"${name}\" must be one of ${variants.join(', ')}`);\n\t}\n};\n\nconst parseHexColor = (hex: string, name: keyof MetallicSwirlParams): Rgb => {","sourceCodeStart":274,"sourceCodeEnd":310,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/brand/src/effects/metallic-swirl-effect.ts#L274-L310","documentation":"`validateRange` runs after `resolve()` fills defaults, so every numeric field is checked against its schema min/max even if the caller omitted it. Fields and bounds: speed 0–10, zoom 0.01–50, iterations 1–12, sampleGap 0.0001–1, tangentForce -5–5, gradientForce -5–5, colorRange 0–2, colorBias 0–2, brightness 0–5, opacity 0–1. A value outside its range throws with the bounds in the message.","triggerScenarios":"`metallicSwirl({speed: 100})` (>10), `metallicSwirl({zoom: 0})` (<0.01), `metallicSwirl({opacity: 2})` (>1), `metallicSwirl({iterations: 20})` (>12), `metallicSwirl({sampleGap: 0})` (<0.0001).","commonSituations":"Slider/Form inputs without clamp; copying values from a different effect with different bounds; user-typed values that exceed the documented range; animating a value that briefly overshoots.","solutions":["Clamp the value to the documented range before passing: `Math.min(10, Math.max(0, speed))`.","Check the message for the exact min/max, then constrain your input/UI to that range.","If you genuinely need a wider range, animate around the default and keep the field within bounds.","Validate form input before submission."],"exampleFix":"// before\nmetallicSwirl({speed: userInput}); // userInput may be 100\n\n// after\nconst speed = Math.min(10, Math.max(0, Number(userInput)));\nmetallicSwirl({speed});","handlingStrategy":"validation","validationCode":"// Clamp each numeric param to its schema range before passing.\nconst RANGES = {\n  speed: [0, 10], zoom: [0.01, 50], iterations: [1, 12],\n  sampleGap: [0.0001, 1], tangentForce: [-5, 5], gradientForce: [-5, 5],\n  colorRange: [0, 2], colorBias: [0, 2], brightness: [0, 5], opacity: [0, 1],\n} as const;\n\nconst clamp = (v: number, [min, max]: readonly [number, number]) =>\n  Math.min(max, Math.max(min, v));\n\nmetallicSwirl({speed: clamp(Number(raw.speed), RANGES.speed)});","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Constrain form/slider inputs to the documented min/max in the UI.","Clamp values from external data sources before passing.","Keep animatable values inside their ranges even during easing overshoots.","When in doubt, omit the key to use the safe default."],"tags":["brand","metallic-swirl","validation","params","range"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}