remotion-dev/remotion · error · Error
"fps" must not be NaN, but got ${fps} ${location}
Error message
"fps" must not be NaN, but got ${fps} ${location} What it means
Even though `Number.isFinite(NaN)` is `false` and would be caught by the earlier `!Number.isFinite` check in practice, this branch exists as a defensive explicit NaN guard inside `validateFps()`. It signals that the caller passed `NaN` as the frame rate.
Source
Thrown at packages/core/src/validation/validate-fps.ts:19
export function validateFps(
fps: unknown,
location: string,
isGif: boolean,
): asserts fps is number {
if (typeof fps !== 'number') {
throw new Error(
`"fps" must be a number, but you passed a value of type ${typeof fps} ${location}`,
);
}
if (!Number.isFinite(fps)) {
throw new Error(
`"fps" must be a finite, but you passed ${fps} ${location}`,
);
}
if (isNaN(fps)) {
throw new Error(`"fps" must not be NaN, but got ${fps} ${location}`);
}
if (fps <= 0) {
throw new TypeError(`"fps" must be positive, but got ${fps} ${location}`);
}
if (isGif && fps > 50) {
throw new TypeError(
`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`,
);
}
}
View on GitHub (pinned to 78fe4bb3fd)
Solutions
- Replace the `NaN` source with a concrete number.
- Guard the input: `const fps = Number.isNaN(raw) ? 30 : raw;`.
- Trace upstream: log the value just before it is passed to find where `NaN` originates.
Example fix
// before
const fps = parseInt(userInput.fps); // NaN when empty
<Composition fps={fps} ... />
// after
const fps = Number.parseInt(userInput.fps, 10);
<Composition fps={Number.isNaN(fps) ? 30 : fps} ... /> Defensive patterns
Strategy: validation
Validate before calling
const fps = Number.isNaN(rawFps) ? 30 : rawFps;
Type guard
const isValidFps = (v: unknown): v is number => typeof v === 'number' && Number.isFinite(v) && !Number.isNaN(v) && v > 0;
Prevention
- Validate parsed fps with `Number.isNaN` before use.
- Treat empty user input as a default, not NaN.
- Audit any `parseInt`/`Number` call whose input may be undefined.
When it happens
Trigger: Passing `fps={NaN}` to a composition, or a value derived from `parseInt(undefined)`, `Number(undefined)`, or `0/0`.
Common situations: Parsing form input where the field is empty (`Number('')` is `0`, but `parseInt(undefined)` is `NaN`), or arithmetic on `undefined` numerics.
Related errors
- "fps" must be a finite, but you passed ${fps} ${location}
- "fps" must be positive, but got ${fps} ${location}
- "fps" must be a number, but you passed a value of type ${typ
- A "duration" of a spring is NaN, which it must not be
- Argument passed to "${api}" for param "${param}" is ${JSON.s
AI-assisted analysis of remotion-dev/remotion@78fe4bb3fd (2026-08-12).
Data as JSON: /api/errors/7a3c30b02a5745d7.
Report an issue: GitHub.