{"record":{"id":"97a662102680e38e","repo":"remotion-dev/remotion","slug":"seed-must-be-a-finite-number-but-got-json-str","errorCode":null,"errorMessage":"\"seed\" must be a finite number, but got ${JSON.stringify(seed)}","messagePattern":"\"seed\" must be a finite number, but got (.+?)","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"packages/light-leaks/src/LightLeak.tsx","lineNumber":276,"sourceCode":"\t...Internals.premountSchema,\n} as const satisfies InteractivitySchema;\n\nconst LightLeakInner: React.FC<\n\tLightLeakProps & {\n\t\treadonly controls: SequenceControls | undefined;\n\t}\n> = ({\n\tseed = 0,\n\thueShift = 0,\n\tdurationInFrames,\n\tstyle,\n\tcontrols,\n\t...sequenceProps\n}) => {\n\tconst {durationInFrames: videoDuration} = useVideoConfig();\n\tconst resolvedDuration = durationInFrames ?? videoDuration;\n\tif (typeof seed !== 'number' || !Number.isFinite(seed)) {\n\t\tthrow new TypeError(\n\t\t\t`\"seed\" must be a finite number, but got ${JSON.stringify(seed)}`,\n\t\t);\n\t}\n\n\tif (typeof hueShift !== 'number' || !Number.isFinite(hueShift)) {\n\t\tthrow new TypeError(\n\t\t\t`\"hueShift\" must be a finite number, but got ${JSON.stringify(hueShift)}`,\n\t\t);\n\t}\n\n\tif (hueShift < 0 || hueShift > 360) {\n\t\tthrow new RangeError(\n\t\t\t`\"hueShift\" must be between 0 and 360, but got ${hueShift}`,\n\t\t);\n\t}\n\n\treturn (\n\t\t<Sequence","sourceCodeStart":258,"sourceCodeEnd":294,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/light-leaks/src/LightLeak.tsx#L258-L294","documentation":"LightLeak validates its seed prop at render time and throws a TypeError if seed is not a number or is not finite (NaN, Infinity). The seed drives the deterministic pseudo-randomness of the light-leak texture, so a non-finite value would break reproducibility.","triggerScenarios":"Passing seed as a string (e.g. from a URL param), undefined arithmetic that yields NaN, Infinity from a divide-by-zero, or null.","commonSituations":"Reading seed from query params without Number(); computing seed = a/b where b can be 0; passing a prop from a CMS as a string.","solutions":["Coerce seed to a finite number before passing: Number(seed) and guard with Number.isFinite.","Default seed to 0 when the source value is missing.","If animating seed, use interpolate() with extrapolateLeft:'clamp'/extrapolateRight:'clamp'."],"exampleFix":"// before\n<LightLeak seed={seedStr} />\n// after\nconst seedNum = Number(seedStr);\n<LightLeak seed={Number.isFinite(seedNum) ? seedNum : 0} />","handlingStrategy":"validation","validationCode":"function toSeed(v: unknown): number {\n  const n = typeof v === 'number' ? v : Number(v);\n  return Number.isFinite(n) ? n : 0;\n}","typeGuard":"const isFiniteNumber = (v: unknown): v is number =>\n  typeof v === 'number' && Number.isFinite(v);","tryCatchPattern":null,"preventionTips":["Always coerce seed with Number() and validate Number.isFinite before passing.","Default to 0 when seed comes from an untrusted source (URL, CMS).","Use interpolate() with clamp extrapolation when animating seed.","Type your component props as `seed?: number` to surface mistakes at compile time."],"tags":["typescript","light-leaks","validation","props","react"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}