{"record":{"id":"49b77e658be98262","repo":"remotion-dev/remotion","slug":"fps-must-be-a-finite-but-you-passed-fps-lo","errorCode":null,"errorMessage":"\"fps\" must be a finite, but you passed ${fps} ${location}","messagePattern":"\"fps\" must be a finite, but you passed (.+?) (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/core/src/validation/validate-fps.ts","lineNumber":13,"sourceCode":"export function validateFps(\n\tfps: unknown,\n\tlocation: string,\n\tisGif: boolean,\n): asserts fps is number {\n\tif (typeof fps !== 'number') {\n\t\tthrow new Error(\n\t\t\t`\"fps\" must be a number, but you passed a value of type ${typeof fps} ${location}`,\n\t\t);\n\t}\n\n\tif (!Number.isFinite(fps)) {\n\t\tthrow new Error(\n\t\t\t`\"fps\" must be a finite, but you passed ${fps} ${location}`,\n\t\t);\n\t}\n\n\tif (isNaN(fps)) {\n\t\tthrow new Error(`\"fps\" must not be NaN, but got ${fps} ${location}`);\n\t}\n\n\tif (fps <= 0) {\n\t\tthrow new TypeError(`\"fps\" must be positive, but got ${fps} ${location}`);\n\t}\n\n\tif (isGif && fps > 50) {\n\t\tthrow new TypeError(\n\t\t\t`The FPS for a GIF cannot be higher than 50. Use the --every-nth-frame option to lower the FPS: https://remotion.dev/docs/render-as-gif`,\n\t\t);\n\t}\n}","sourceCodeStart":1,"sourceCodeEnd":31,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/core/src/validation/validate-fps.ts#L1-L31","documentation":"`validateFps()` rejects non-finite `fps` values such as `Infinity` or `-Infinity`. These pass the `typeof === 'number'` check but are not usable as a frame rate because Remotion divides durations by fps and indexes frames by integer math.","triggerScenarios":"Passing `fps={Infinity}`, `fps={-Infinity}`, or the result of an arithmetic operation that overflows (e.g. `fps={1/0}`) into a composition or video config.","commonSituations":"Computed fps values derived from ratios that divide by zero, or accidental `Math.max(...)` over an empty array returning `-Infinity`.","solutions":["Replace the offending value with a concrete finite number such as `30`.","Audit any arithmetic that produces fps and clamp it, e.g. `Number.isFinite(fps) ? fps : 30`.","If fps comes from user input, validate with `Number.isFinite` before passing it to the composition."],"exampleFix":"// before\nconst fps = someRatio / 0; // Infinity\n<Composition fps={fps} ... />\n// after\nconst fps = Number.isFinite(someRatio / 0) ? someRatio / 0 : 30;\n<Composition fps={fps} ... />","handlingStrategy":"validation","validationCode":"const safeFps = Number.isFinite(rawFps) && typeof rawFps === 'number' ? rawFps : 30;","typeGuard":"const isFiniteNumber = (v: unknown): v is number => typeof v === 'number' && Number.isFinite(v);","tryCatchPattern":null,"preventionTips":["Avoid unbounded arithmetic when computing fps.","Wrap external fps inputs with `Number.isFinite` checks.","Add unit tests for edge inputs (Infinity, NaN, 0)."],"tags":["validation","config","fps","numeric"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}