{"record":{"id":"0d0ce23ad82729d2","repo":"remotion-dev/remotion","slug":"name-must-be-max-but-got-json-string-0d0ce2","errorCode":null,"errorMessage":"\"${name}\" must be <= ${max}, but got ${JSON.stringify(value)}","messagePattern":"\"(.+?)\" must be <= (.+?), but got (.+?)","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"packages/effects/src/roughen-edges.ts","lineNumber":105,"sourceCode":"\t\treadonly uAmount: WebGLUniformLocation | null;\n\t\treadonly uBorder: WebGLUniformLocation | null;\n\t\treadonly uScale: WebGLUniformLocation | null;\n\t\treadonly uSeed: WebGLUniformLocation | null;\n\t\treadonly uNoiseTexture: WebGLUniformLocation | null;\n\t};\n\tcachedNoiseSeed: number;\n};\n\nconst resolve = (p: RoughenEdgesParams): RoughenEdgesResolved => ({\n\tamount: p.amount ?? DEFAULT_AMOUNT,\n\tborder: p.border ?? DEFAULT_BORDER,\n\tscale: p.scale ?? DEFAULT_SCALE,\n\tseed: p.seed ?? DEFAULT_SEED,\n});\n\nconst validateAtMost = (value: number, max: number, name: string): void => {\n\tif (value > max) {\n\t\tthrow new TypeError(\n\t\t\t`\"${name}\" must be <= ${max}, but got ${JSON.stringify(value)}`,\n\t\t);\n\t}\n};\n\nconst validateRoughenEdgesParams = (params: RoughenEdgesParams): void => {\n\tassertEffectParamsObject(params, 'Roughen edges');\n\tassertOptionalFiniteNumber(params.amount, 'amount');\n\tassertOptionalFiniteNumber(params.border, 'border');\n\tassertOptionalFiniteNumber(params.scale, 'scale');\n\tassertOptionalFiniteNumber(params.seed, 'seed');\n\n\tconst r = resolve(params);\n\tvalidateUnitInterval(r.amount, 'amount');\n\tvalidateNonNegative(r.border, 'border');\n\tvalidateAtMost(r.border, MAX_BORDER, 'border');\n\tif (r.scale <= 0) {\n\t\tthrow new TypeError(","sourceCodeStart":87,"sourceCodeEnd":123,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/effects/src/roughen-edges.ts#L87-L123","documentation":"Thrown by the `roughenEdges()` effect when a numeric prop exceeds its documented upper bound. `validateAtMost` is applied to three resolved props: `border` (max 200), `scale` (max 4), and `seed` (max 1000). Values up to and including the max are allowed; anything strictly greater throws. The check runs after defaults are applied, so omitting a prop never trips this.","triggerScenarios":"Call `roughenEdges({border: 250})`, `roughenEdges({scale: 5})`, or `roughenEdges({seed: 1500})`. Also triggered by animating past the cap without clamping, e.g. `interpolate(frame, [0, 100], [0, 300])` for `border`.","commonSituations":"Loading serialized presets that were authored against a different max; copying values from another tool's slider scale; animating a prop with an unclamped output range.","solutions":["Bring the value within range: `border` ≤ 200, `scale` ≤ 4, `seed` ≤ 1000.","Clamp animated values with `Math.min(max, value)` or `interpolate(..., {extrapolateRight: 'clamp'})`.","Validate serialized presets before passing them to `roughenEdges()`."],"exampleFix":"// before\nroughenEdges({border: interpolate(frame, [0, 100], [0, 300])});\n// after\nroughenEdges({\n  border: interpolate(frame, [0, 100], [0, 200], {extrapolateRight: 'clamp'}),\n});","handlingStrategy":"validation","validationCode":"const ROUGHEN_BOUNDS = {\n  border: {min: 0, max: 200},\n  scale: {min: 0.01, max: 4},\n  seed: {min: 0, max: 1000},\n} as const;\n\nconst clampRoughenProp = (\n  value: number,\n  bound: {min: number; max: number},\n): number => Math.min(bound.max, Math.max(bound.min, value));\n\n// before calling roughenEdges()\nconst safe = {\n  border: clampRoughenProp(config.border ?? 26.5, ROUGHEN_BOUNDS.border),\n  scale: clampRoughenProp(config.scale ?? 0.07, ROUGHEN_BOUNDS.scale),\n  seed: clampRoughenProp(config.seed ?? 231.2, ROUGHEN_BOUNDS.seed),\n};\nroughenEdges(safe);","typeGuard":"const isWithinRoughenBounds = (\n  value: unknown,\n  min: number,\n  max: number,\n): value is number =>\n  typeof value === 'number' &&\n  Number.isFinite(value) &&\n  value >= min &&\n  value <= max;","tryCatchPattern":null,"preventionTips":["Clamp animated `border`/`scale`/`seed` output ranges with `extrapolateLeft/Right: 'clamp'`.","Keep a single source of truth for the bounds in your app, mirroring the schema.","Validate serialized presets against the bounds before applying them."],"tags":["validation","roughen-edges-effect","effects","typescript","params"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}