{"record":{"id":"a21aef2ad836b5fe","repo":"remotion-dev/remotion","slug":"name-must-be-greater-than-or-equal-to-0-but-a21aef","errorCode":null,"errorMessage":"\"${name}\" must be greater than or equal to 0, but got ${JSON.stringify(value)}","messagePattern":"\"(.+?)\" must be greater than or equal to 0, but got (.+?)","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"packages/effects/src/gridlines.ts","lineNumber":205,"sourceCode":"\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');\n\tassertOptionalFiniteNumber(params.rotationX, 'rotationX');\n\tassertOptionalFiniteNumber(params.rotationY, 'rotationY');\n\tassertOptionalFiniteNumber(params.perspective, 'perspective');\n\tassertOptionalFiniteNumber(params.offsetX, 'offsetX');\n\tassertOptionalFiniteNumber(params.offsetY, 'offsetY');\n\tassertOptionalColor(params.lineColor, 'lineColor');\n\tassertOptionalColor(params.backgroundColor, 'backgroundColor');\n\tassertOptionalBoolean(params.maskToSourceAlpha, 'maskToSourceAlpha');","sourceCodeStart":187,"sourceCodeEnd":223,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/effects/src/gridlines.ts#L187-L223","documentation":"TypeError thrown by gridlines' validateNonNegative helper (gridlines.ts:203) for parameters allowed to be zero but not negative. In Gridlines it guards lineWidth and perspective. The message identifies the field and shows the offending value.","triggerScenarios":"validateGridlinesParams calls validateNonNegative for lineWidth (line 226) and perspective (line 227). Triggered by passing lineWidth < 0 or perspective < 0. Zero is allowed (no lines / no perspective), so only strictly negative finite values hit this.","commonSituations":"Negative lineWidth or perspective from a typo, an animation overshoot (e.g. spring interpolating below 0), or deriving the value from an offset/scale that can go negative.","solutions":["Pass lineWidth/perspective as 0 or a positive number.","Clamp animated values: Math.max(0, value).","If you meant 'no perspective', pass perspective: 0 explicitly rather than a negative."],"exampleFix":"// before\n<Gridlines lineWidth={spring.width - 10} />\n// spring can dip below 10 -> negative lineWidth\n\n// after\n<Gridlines lineWidth={Math.max(0, spring.width - 10)} />","handlingStrategy":"validation","validationCode":"const assertNonNegative = (v: number, name: string) => {\n  if (!Number.isFinite(v) || v < 0) {\n    throw new TypeError(`${name} must be >= 0, got ${v}`);\n  }\n};\nassertNonNegative(params.lineWidth ?? 0, 'lineWidth');\nassertNonNegative(params.perspective ?? 0, 'perspective');","typeGuard":"const isNonNegative = (v: unknown): v is number =>\n  typeof v === 'number' && Number.isFinite(v) && v >= 0;","tryCatchPattern":"null","preventionTips":["Clamp animated lineWidth/perspective with Math.max(0, value).","Pass 0 explicitly to mean 'none' rather than a negative.","Watch spring/interpolation overshoot below zero."],"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"}