{"record":{"id":"f9b017d27cbd8350","repo":"remotion-dev/remotion","slug":"name-must-be-greater-than-0-but-got-json-s-f9b017","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/gridlines.ts","lineNumber":197,"sourceCode":"};\n\nconst resolve = (p: GridlinesParams): GridlinesResolved => ({\n\tgridSize: p.gridSize ?? DEFAULT_GRID_SIZE,\n\tlineWidth: p.lineWidth ?? DEFAULT_LINE_WIDTH,\n\tlineColor: p.lineColor ?? DEFAULT_LINE_COLOR,\n\tbackgroundColor: p.backgroundColor ?? DEFAULT_BACKGROUND_COLOR,\n\trotation: p.rotation ?? DEFAULT_ROTATION,\n\trotationX: p.rotationX ?? DEFAULT_ROTATION_X,\n\trotationY: p.rotationY ?? DEFAULT_ROTATION_Y,\n\tperspective: p.perspective ?? DEFAULT_PERSPECTIVE,\n\toffsetX: p.offsetX ?? DEFAULT_OFFSET_X,\n\toffsetY: p.offsetY ?? DEFAULT_OFFSET_Y,\n\tmaskToSourceAlpha: p.maskToSourceAlpha ?? DEFAULT_MASK_TO_SOURCE_ALPHA,\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 validateNonNegative = (value: number, name: string): void => {\n\tif (value < 0) {\n\t\tthrow new TypeError(\n\t\t\t`\"${name}\" must be greater than or equal to 0, but got ${JSON.stringify(value)}`,\n\t\t);\n\t}\n};\n\nconst validateGridlinesParams = (params: GridlinesParams): void => {\n\tassertEffectParamsObject(params, 'Gridlines');\n\tassertOptionalFiniteNumber(params.gridSize, 'gridSize');\n\tassertOptionalFiniteNumber(params.lineWidth, 'lineWidth');\n\tassertOptionalFiniteNumber(params.rotation, 'rotation');","sourceCodeStart":179,"sourceCodeEnd":215,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/effects/src/gridlines.ts#L179-L215","documentation":"TypeError thrown by gridlines' validatePositive helper (gridlines.ts:195) when a parameter that must be strictly positive is <= 0. In Gridlines it guards gridSize, which controls spacing between lines and cannot be zero or negative. The message names the offending field and echoes the bad value via JSON.stringify.","triggerScenarios":"validateGridlinesParams calls validatePositive(params.gridSize ?? DEFAULT_GRID_SIZE, 'gridSize') (gridlines.ts:225). Triggered by passing gridSize: 0, a negative gridSize, or relying on a default of 0. (NaN/Infinity are rejected earlier by assertOptionalFiniteNumber, so this path is specifically finite <= 0 values.)","commonSituations":"Passing gridSize: 0 to disable lines, animating gridSize through 0, computing gridSize from a formula that can hit zero (e.g. width / columns with columns larger than width), or copy-pasting a config from another effect whose units differ.","solutions":["Set gridSize to a strictly positive number (e.g. 32).","If animating, clamp the lower bound above 0: Math.max(1, value).","Derive gridSize from a positive source and guard the divisor: ensure width/columns keeps the result > 0."],"exampleFix":"// before\n<Gridlines gridSize={Math.floor(width / columns)} />\n// columns > width -> gridSize = 0 -> TypeError\n\n// after\n<Gridlines gridSize={Math.max(1, Math.floor(width / columns))} />","handlingStrategy":"validation","validationCode":"const assertGridSize = (v: number) => {\n  if (!Number.isFinite(v) || v <= 0) {\n    throw new TypeError(`gridSize must be > 0, got ${v}`);\n  }\n};\nassertGridSize(params.gridSize ?? DEFAULT_GRID_SIZE);","typeGuard":"const isValidGridSize = (v: unknown): v is number =>\n  typeof v === 'number' && Number.isFinite(v) && v > 0;","tryCatchPattern":"null","preventionTips":["Animate gridSize with a floor: Math.max(1, value).","Guard any divisor used to derive gridSize.","Run the effect's validateParams before rendering to fail early.","Treat 0 as invalid for gridSize specifically."],"tags":["gridlines-effect","validation","typescript","params"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}