{"record":{"id":"a623c2939cd9e954","repo":"remotion-dev/remotion","slug":"name-must-be-greater-than-0-but-got-json-s-a623c2","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/halftone-linear-gradient.ts","lineNumber":204,"sourceCode":"\t] as UvCoordinate,\n\tgridSize: p.gridSize ?? DEFAULT_GRID_SIZE,\n\tcolorMode: p.colorMode ?? 'solid',\n\tdotColor:\n\t\t'dotColor' in p ? (p.dotColor ?? DEFAULT_DOT_COLOR) : DEFAULT_DOT_COLOR,\n\tmaskToSourceAlpha: p.maskToSourceAlpha ?? DEFAULT_MASK_TO_SOURCE_ALPHA,\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 >= 0, 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 assertOptionalUvCoordinate = (value: unknown, name: string): void => {\n\tif (value === undefined) {\n\t\treturn;\n\t}\n\n\tif (\n\t\t!Array.isArray(value) ||\n\t\tvalue.length !== 2 ||\n\t\tvalue.some((item) => typeof item !== 'number' || !Number.isFinite(item))\n\t) {\n\t\tthrow new TypeError(`\"${name}\" must be a [number, number] tuple`);\n\t}\n};","sourceCodeStart":186,"sourceCodeEnd":222,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/effects/src/halftone-linear-gradient.ts#L186-L222","documentation":"TypeError thrown by halftone-linear-gradient's validatePositive (halftone-linear-gradient.ts:202) when a value that must be strictly positive is <= 0. It guards gridSize (the spacing of the halftone cell grid). Zero or negative gridSize is rejected because the grid would be undefined.","triggerScenarios":"validateHalftoneLinearGradientParams validates gridSize > 0 (around line 259). Triggered by passing gridSize: 0, a negative gridSize, or relying on a default of 0. (Non-finite values are caught earlier by assertOptionalFiniteNumber.)","commonSituations":"gridSize: 0 to 'disable' halftone; animating gridSize through zero; deriving gridSize from width/columns where columns can exceed width; a typo.","solutions":["Set gridSize to a strictly positive number (e.g. 8).","Clamp animated values above zero: Math.max(1, value).","Guard any divisor used to compute gridSize."],"exampleFix":"// before\n<halftoneLinearGradient gridSize={Math.floor(width / cols)} />\n// cols > width -> gridSize 0\n\n// after\n<halftoneLinearGradient gridSize={Math.max(1, Math.floor(width / cols))} />","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 validateParams early to fail before render."],"tags":["halftone-linear-gradient-effect","validation","typescript","params"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}