{"record":{"id":"65de5f6d4e231dd2","repo":"remotion-dev/remotion","slug":"name-must-be-greater-than-0-but-got-json-s-65de5f","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/zigzag.ts","lineNumber":196,"sourceCode":"\t\twavelength: p.wavelength ?? DEFAULT_WAVELENGTH,\n\t\tmaskToSourceAlpha: p.maskToSourceAlpha ?? DEFAULT_MASK_TO_SOURCE_ALPHA,\n\t};\n};\n\nconst formatEnum = (variants: readonly string[]): string => {\n\tif (variants.length === 2) {\n\t\treturn `\"${variants[0]}\" or \"${variants[1]}\"`;\n\t}\n\n\treturn `${variants\n\t\t.slice(0, -1)\n\t\t.map((variant) => `\"${variant}\"`)\n\t\t.join(', ')} or \"${variants[variants.length - 1]}\"`;\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 validateColors = (colors: unknown): void => {\n\tif (colors === undefined) {\n\t\treturn;\n\t}\n","sourceCodeStart":178,"sourceCodeEnd":214,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/effects/src/zigzag.ts#L178-L214","documentation":"Zigzag validates that thickness and wavelength are strictly greater than zero via validatePositive, throwing a TypeError naming the offending field. thickness defaults to 40 and wavelength to 160; passing 0 or a negative number for either is rejected because a zero/negative stripe thickness or wave wavelength makes the shader's spacing math degenerate. This is the only error in this set caused by caller input rather than the GPU.","triggerScenarios":"Calling zigzag({thickness: 0}), zigzag({thickness: -10}), zigzag({wavelength: 0}), or zigzag({wavelength: -1}); also when an interpolated/keyframed value animates thickness or wavelength through or below zero.","commonSituations":"Confusing thickness (must be > 0) with gap (allows 0) and passing 0 to disable stripes; animating a value that dips negative at the curve endpoints; computing thickness/wavelength from a subtraction that can hit zero; passing a value below the schema min (thickness min 0.1, wavelength min not enforced at runtime the same way).","solutions":["Pass a strictly positive value: thickness >= 0.1 (the schema min) and wavelength > 0.","If you want 'no stripe', use gap (which accepts 0) or omit the effect conditionally, rather than zeroing thickness.","Clamp animated values with Math.max(0.1, value) before passing them to thickness.","For wavelength, use Math.max(1, value) or keep it at/below the default 160 range."],"exampleFix":"// before\nzigzag({thickness: 0});        // throws\nzigzag({wavelength: value});   // throws when value <= 0\n\n// after\nzigzag({thickness: 0.1});                  // smallest valid\nzigzag({wavelength: Math.max(1, value)});  // guard animated input","handlingStrategy":"validation","validationCode":"import {zigzag} from '@remotion/effects';\n\nconst thickness = 0;          // would throw\nconst wavelength = someAnim;  // might be <= 0\n\nif (thickness <= 0) throw new Error('thickness must be > 0');\nif (wavelength <= 0) wavelength = 1; // clamp instead\n\nzigzag({thickness, wavelength});","typeGuard":"const isPositiveNumber = (v: unknown, name = 'value'): v is number =>\n  typeof v === 'number' && Number.isFinite(v) && v > 0;\n\n// usage:\nif (!isPositiveNumber(params.thickness, 'thickness')) { /* handle */ }","tryCatchPattern":"try {\n  return <VideoEffects effects={[zigzag({thickness, wavelength})]} />;\n} catch (err) {\n  if (err instanceof TypeError && /must be greater than 0/.test(err.message)) {\n    // re-render with clamped/omitted offending field\n    return <VideoEffects effects={[zigzag({thickness: 0.1, wavelength: 160})]} />;\n  }\n  throw err;\n}","preventionTips":["Remember thickness and wavelength must be > 0; gap and amplitude allow 0 (use those to 'disable').","Clamp animated values with Math.max(0.1, x) for thickness and Math.max(1, x) for wavelength.","Respect the schema min values (thickness min 0.1) when building UI controls.","Add a unit test that feeds boundary values (0, negative) to catch regressions."],"tags":["validation","typescript","api-misuse","effect-params"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}