{"record":{"id":"829083376496aad3","repo":"remotion-dev/remotion","slug":"name-must-be-an-integer-but-got-json-strin-829083","errorCode":null,"errorMessage":"\"${name}\" must be an integer, but got ${JSON.stringify(value)}","messagePattern":"\"(.+?)\" must be an integer, but got (.+?)","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"packages/effects/src/venetian-blinds.ts","lineNumber":100,"sourceCode":"\t\treturn;\n\t}\n\n\tif (!variants.includes(value as T)) {\n\t\tthrow new TypeError(\n\t\t\t`\"${name}\" must be ${formatEnum(variants)}, but got ${JSON.stringify(value)}`,\n\t\t);\n\t}\n};\n\nconst resolve = (p: VenetianBlindsParams): VenetianBlindsResolved => ({\n\tprogress: p.progress ?? DEFAULT_PROGRESS,\n\tdirection: p.direction ?? DEFAULT_DIRECTION,\n\tslats: p.slats ?? DEFAULT_SLATS,\n});\n\nconst validatePositiveInteger = (value: number, name: string): void => {\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\tif (value < 1) {\n\t\tthrow new TypeError(\n\t\t\t`\"${name}\" must be >= 1, but got ${JSON.stringify(value)}`,\n\t\t);\n\t}\n};\n\nconst validateVenetianBlindsParams = (params: VenetianBlindsParams): void => {\n\tassertEffectParamsObject(params, 'Venetian blinds');\n\tassertOptionalFiniteNumber(params.progress, 'progress');\n\tassertOptionalFiniteNumber(params.slats, 'slats');\n\tassertOptionalEnum(params.direction, 'direction', VENETIAN_BLINDS_DIRECTIONS);\n\n\tconst r = resolve(params);","sourceCodeStart":82,"sourceCodeEnd":118,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/effects/src/venetian-blinds.ts#L82-L118","documentation":"Thrown by the venetian-blinds effect's validatePositiveInteger when the slats parameter (after resolving defaults) is not an integer. The check runs after resolve() applies the default of 12, so it only fires if the caller explicitly set slats to a non-integer like 12.5 or 12.0 (which is actually fine) — really it catches fractional values like 12.5, 3.14, or non-number values that passed the earlier assertOptionalFiniteNumber but fail Number.isInteger.","triggerScenarios":"Calling venetianBlinds({slats: 12.5}) — 12.5 is a finite number so it passes assertOptionalFiniteNumber, but Number.isInteger(12.5) is false, triggering this error.","commonSituations":"Computed slat count from a formula that produces a float (e.g. width / pixelSize); data from a slider with fractional step; user input parsed as float.","solutions":["Pass an integer: venetianBlinds({slats: 12})","Round computed values: venetianBlinds({slats: Math.round(computed)})","Use Math.floor or Math.ceil if rounding direction matters for the visual","Check the schema: slats has min 1, max 100, step 1 — only integers in that range are valid"],"exampleFix":"// before\nconst e = venetianBlinds({slats: width / 64});\n\n// after\nconst e = venetianBlinds({slats: Math.max(1, Math.round(width / 64))});","handlingStrategy":"validation","validationCode":"function isPositiveInteger(value: unknown): boolean {\n  return typeof value === 'number' && Number.isInteger(value) && value >= 1;\n}\n\n// Before calling:\nif (!isPositiveInteger(params.slats)) {\n  throw new Error('slats must be a positive integer');\n}\nconst e = venetianBlinds(params);","typeGuard":"function isPositiveInteger(value: unknown): value is number {\n  return typeof value === 'number' && Number.isInteger(value) && value >= 1;\n}","tryCatchPattern":null,"preventionTips":["Round computed slat counts with Math.round before passing: Math.round(computed)","Check Number.isInteger on user-provided values before passing to the effect","Use the Studio schema (slats: step 1, min 1, max 100) as a guide for valid integer ranges","Avoid passing float results of division formulas directly"],"tags":["validation","typescript","params","typeerror","integer","venetian-blinds"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}