{"record":{"id":"4eb623fc3467716c","repo":"remotion-dev/remotion","slug":"name-must-be-greater-than-0-but-got-json-s-4eb623","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/paper.ts","lineNumber":279,"sourceCode":"\tfolds: p.folds ?? DEFAULT_FOLDS,\n\tfoldCount: p.foldCount ?? DEFAULT_FOLD_COUNT,\n\tdrops: p.drops ?? DEFAULT_DROPS,\n\tfade: p.fade ?? DEFAULT_FADE,\n\tseed: p.seed ?? DEFAULT_SEED,\n\tscale: p.scale ?? DEFAULT_SCALE,\n});\n\nconst validateAtMost = (value: number, max: number, name: string): void => {\n\tif (value > max) {\n\t\tthrow new TypeError(\n\t\t\t`\"${name}\" must be <= ${max}, but got ${JSON.stringify(value)}`,\n\t\t);\n\t}\n};\n\nconst validatePositiveUnitInterval = (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\tvalidateAtMost(value, 1, name);\n};\n\nconst validatePaperParams = (params: PaperParams): void => {\n\tassertEffectParamsObject(params, 'Paper');\n\tassertOptionalFiniteNumber(params.amount, 'amount');\n\tassertOptionalColor(params.colorFront, 'colorFront');\n\tassertOptionalColor(params.colorBack, 'colorBack');\n\tassertOptionalFiniteNumber(params.contrast, 'contrast');\n\tassertOptionalFiniteNumber(params.roughness, 'roughness');\n\tassertOptionalFiniteNumber(params.fiber, 'fiber');\n\tassertOptionalFiniteNumber(params.fiberSize, 'fiberSize');\n\tassertOptionalFiniteNumber(params.crumples, 'crumples');\n\tassertOptionalFiniteNumber(params.crumpleSize, 'crumpleSize');","sourceCodeStart":261,"sourceCodeEnd":297,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/effects/src/paper.ts#L261-L297","documentation":"Thrown by validatePositiveUnitInterval (packages/effects/src/paper.ts:279), which is called only for fiberSize and crumpleSize. It fires when the resolved value is ≤ 0 (the subsequent ≤ 1 check is error 770). Both params are documented as 0.01–1, so zero or negative values are rejected here first.","triggerScenarios":"Calling paper({fiberSize: 0}) or paper({crumpleSize: -0.1}); animating either param down to or below zero without clamping.","commonSituations":"An interpolate() call that ramps to 0; defaults overridden by an empty/zero from a config; negative values from a mis-scaled UI control.","solutions":["Set fiberSize/crumpleSize to a value in (0, 1] (minimum 0.01).","Clamp animations: interpolate(..., {extrapolateLeft: 'clamp', extrapolateRight: 'clamp'}) and use a floor like Math.max(0.01, value).","Pre-validate with the guard below."],"exampleFix":"// before\npaper({fiberSize: 0, crumpleSize: 0.35}); // throws on fiberSize\n\n// after\npaper({fiberSize: 0.2, crumpleSize: 0.35});","handlingStrategy":"validation","validationCode":"// Ensure fiberSize and crumpleSize are within (0, 1]\nfunction sanitizePositiveUnit(v: number | undefined, floor = 0.01): number | undefined {\n  if (v === undefined) return undefined;\n  if (typeof v !== 'number' || !Number.isFinite(v) || v <= 0) return floor;\n  return Math.min(v, 1);\n}\n\n// usage: paper({fiberSize: sanitizePositiveUnit(raw.fiberSize)})","typeGuard":"const isPositiveUnitInterval = (v: unknown): v is number =>\n  typeof v === 'number' && Number.isFinite(v) && v > 0 && v <= 1;","tryCatchPattern":"try {\n  paper({fiberSize: raw.fiberSize, crumpleSize: raw.crumpleSize});\n} catch (err) {\n  if (err instanceof TypeError && /must be greater than 0/.test(err.message)) {\n    paper({fiberSize: Math.max(0.01, raw.fiberSize), crumpleSize: Math.max(0.01, raw.crumpleSize)});\n  } else throw err;\n}","preventionTips":["Floor animated fiberSize/crumpleSize at 0.01 with Math.max or extrapolateLeft: 'clamp'.","Validate externally sourced params before calling paper().","Match UI control minimums to the documented 0.01 floor."],"tags":["validation","params","paper","effects","range"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}