{"record":{"id":"ad0894003a475c9e","repo":"remotion-dev/remotion","slug":"name-must-be-greater-than-0-but-got-json-s-ad0894","errorCode":null,"errorMessage":"\"${name}\" must be greater than 0, but got ${JSON.stringify(value)}","messagePattern":"\"(.+?)\" must be greater than 0, but got (.+?)","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"packages/effects/src/dot-grid.ts","lineNumber":73,"sourceCode":"\tgridSize: p.gridSize ?? DEFAULT_GRID_SIZE,\n\tinvert: p.invert ?? DEFAULT_INVERT,\n});\n\nconst assertOptionalBoolean = (value: unknown, name: string): void => {\n\tif (value === undefined) {\n\t\treturn;\n\t}\n\n\tif (typeof value !== 'boolean') {\n\t\tthrow new TypeError(\n\t\t\t`\"${name}\" must be a boolean, but got ${JSON.stringify(value)}`,\n\t\t);\n\t}\n};\n\nconst validatePositive = (value: number, name: string): void => {\n\tif (value <= 0) {\n\t\tthrow new TypeError(\n\t\t\t`\"${name}\" must be greater than 0, but got ${JSON.stringify(value)}`,\n\t\t);\n\t}\n};\n\nconst validateDotGridParams = (params: DotGridParams): void => {\n\tassertEffectParamsObject(params, 'Dot grid');\n\tassertOptionalFiniteNumber(params.dotSize, 'dotSize');\n\tassertOptionalFiniteNumber(params.gridSize, 'gridSize');\n\tassertOptionalBoolean(params.invert, 'invert');\n\n\tif (params.dotSize !== undefined) {\n\t\tvalidateNonNegative(params.dotSize, 'dotSize');\n\t}\n\n\tif (params.gridSize !== undefined) {\n\t\tvalidatePositive(params.gridSize, 'gridSize');\n\t}","sourceCodeStart":55,"sourceCodeEnd":91,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/effects/src/dot-grid.ts#L55-L91","documentation":"Thrown by the dot-grid effect's validatePositive guard when gridSize is supplied and is less than or equal to zero. gridSize controls cell spacing in the dot-grid fragment shader; a non-positive value would cause division by zero or infinite cells. dotSize is allowed to be zero (covered by a separate non-negative check), but gridSize must be strictly positive.","triggerScenarios":"Calling dotGrid() with gridSize: 0, gridSize: -10, or gridSize: -0. Also reached if gridSize is animated down to zero or below through an interpolate/Spring whose range crosses zero, or if a default of 0 is set in external config.","commonSituations":"Animation easing curves that overshoot below zero; user-facing sliders that allow 0 as the floor; importing grid spacing from CSS where 0 means 'auto'; copy-pasting a 0 from a disabled state.","solutions":["Set gridSize to a positive integer such as 20 (the default).","Clamp animated values: gridSize: Math.max(1, Math.round(value)).","If 0 is a meaningful 'no grid' state in your UI, conditionally omit the dotGrid() effect rather than passing gridSize: 0.","Audit interpolate() input/output ranges so the floor is >= 1."],"exampleFix":"// before\ndotGrid({gridSize: interpolate(frame, [0, 30], [40, 0])});\n\n// after\ndotGrid({gridSize: Math.max(1, Math.round(interpolate(frame, [0, 30], [40, 1])))});","handlingStrategy":"validation","validationCode":"const safeGridSize = (n) =>\n  typeof n === 'number' && Number.isFinite(n) ? Math.max(1, Math.round(n)) : undefined;\n\nconst params = {};\nconst g = safeGridSize(rawGridSize);\nif (g !== undefined) params.gridSize = g;\ndotGrid(params);","typeGuard":"const isPositiveInt = (v: unknown): v is number =>\n  typeof v === 'number' && Number.isFinite(v) && v > 0;\n\nconst safeGridSize = (v: unknown): number => {\n  if (!isPositiveInt(v)) {\n    throw new TypeError(`gridSize must be a positive number, got ${String(v)}`);\n  }\n  return v;\n};","tryCatchPattern":null,"preventionTips":["Clamp animated gridSize with Math.max(1, ...) before passing it in.","Audit interpolate() ranges so the lower bound never crosses 0.","If your UI legitimately means 'no grid', conditionally omit the dotGrid() effect rather than passing 0."],"tags":["validation","dot-grid","positive-number","input-validation","math"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}