{"record":{"id":"741ac6ce8db2d15e","repo":"remotion-dev/remotion","slug":"name-must-be-min-but-got-json-string","errorCode":null,"errorMessage":"\"${name}\" must be >= ${min}, but got ${JSON.stringify(value)}","messagePattern":"\"(.+?)\" must be >= (.+?), but got (.+?)","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"packages/effects/src/pattern.ts","lineNumber":255,"sourceCode":"\t\treturn;\n\t}\n\n\tif (!Number.isInteger(value)) {\n\t\tthrow new TypeError(\n\t\t\t`\"${name}\" must be an integer, 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(`\"${name}\" must be > 0`);\n\t}\n};\n\nconst validateAtLeast = (value: number, min: number, name: string): void => {\n\tif (value < min) {\n\t\tthrow new TypeError(\n\t\t\t`\"${name}\" must be >= ${min}, but got ${JSON.stringify(value)}`,\n\t\t);\n\t}\n};\n\nconst validatePatternParams = (params: PatternParams): void => {\n\tassertEffectParamsObject(params, 'Pattern');\n\tassertOptionalFiniteNumber(params.scale, 'scale');\n\tassertOptionalFiniteNumber(params.cropLeft, 'cropLeft');\n\tassertOptionalFiniteNumber(params.cropTop, 'cropTop');\n\tassertOptionalFiniteNumber(params.cropRight, 'cropRight');\n\tassertOptionalFiniteNumber(params.cropBottom, 'cropBottom');\n\tassertOptionalFiniteNumber(params.gapX, 'gapX');\n\tassertOptionalFiniteNumber(params.gapY, 'gapY');\n\tassertOptionalFiniteNumber(params.offsetU, 'offsetU');\n\tassertOptionalFiniteNumber(params.offsetV, 'offsetV');\n\tassertOptionalFiniteNumber(params.rowOffset, 'rowOffset');\n\tassertOptionalFiniteNumber(params.rowOffsetEvery, 'rowOffsetEvery');","sourceCodeStart":237,"sourceCodeEnd":273,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/effects/src/pattern.ts#L237-L273","documentation":"validateAtLeast throws when a pattern() prop resolves to a value below its required minimum (e.g. rowOffsetEvery/columnOffsetEvery must be >= 0, scale must be >= its schema min). The message interpolates the expected minimum and the offending value so the failing prop is obvious.","triggerScenarios":"Calling pattern() with a prop below its documented min (rowOffsetEvery: -1, columnOffsetEvery: -2), or animating such a prop below the floor. Checked on resolved values in validatePatternParams.","commonSituations":"Negative defaults inherited from external config; animated counters that dip below zero at the start/end frame; unit conversion errors producing undersized values.","solutions":["Keep the prop at or above its documented minimum (the schema declares min per prop).","Clamp animated values: Math.max(min, value).","Audit imported config against the patternSchema min/max before passing it through."],"exampleFix":"// before\npattern({ rowOffsetEvery: -1 })\n\n// after\npattern({ rowOffsetEvery: Math.max(0, computedEvery) })","handlingStrategy":"validation","validationCode":"// Enforce per-prop minima from the schema before calling pattern().\nconst MIN = { rowOffsetEvery: 0, columnOffsetEvery: 0 } as const;\nfunction clampMin<T extends keyof typeof MIN>(k: T, v: number | undefined) {\n  return v === undefined ? undefined : Math.max(MIN[k], v);\n}\npattern({\n  rowOffsetEvery: clampMin('rowOffsetEvery', raw.rowOffsetEvery),\n  columnOffsetEvery: clampMin('columnOffsetEvery', raw.columnOffsetEvery),\n});","typeGuard":"const isAtLeast = (v: unknown, min: number): v is number =>\n  typeof v === 'number' && Number.isFinite(v) && v >= min;","tryCatchPattern":null,"preventionTips":["Read each prop's min from patternSchema and clamp accordingly.","Reject negative values from imported config at the boundary.","When animating, clamp to the documented floor on every frame.","Unit-test config-driven values against the schema min/max before rendering."],"tags":["validation","typescript","pattern-effect","range","params"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}