remotion-dev/remotion · error · TypeError
Argument passed for "frame" is not a number: ${frame}
Error message
Argument passed for "frame" is not a number: ${frame} What it means
validateFrame throws a TypeError when frame is defined but not of type `number` (e.g. a string, object, NaN-passed-as-non-number). The message echoes the offending value. This catches data flowing from untyped sources (URL params, JSON, props) into frame-based APIs.
Source
Thrown at packages/core/src/validate-frame.ts:15
export const validateFrame = ({
allowFloats,
durationInFrames,
frame,
}: {
frame: number;
durationInFrames: number;
allowFloats: boolean;
}) => {
if (typeof frame === 'undefined') {
throw new TypeError(`Argument missing for parameter "frame"`);
}
if (typeof frame !== 'number') {
throw new TypeError(
`Argument passed for "frame" is not a number: ${frame}`,
);
}
if (!Number.isFinite(frame)) {
throw new RangeError(`Frame ${frame} is not finite`);
}
if (frame % 1 !== 0 && !allowFloats) {
throw new RangeError(
`Argument for frame must be an integer, but got ${frame}`,
);
}
if (frame < 0 && frame < -durationInFrames) {
throw new RangeError(
`Cannot use frame ${frame}: Duration of composition is ${durationInFrames}, therefore the lowest frame that can be rendered is ${-durationInFrames}`,
);View on GitHub (pinned to 78fe4bb3fd)
Solutions
- Convert to number before passing: `Number(rawFrame)` or `parseInt(rawFrame, 10)`.
- Validate with typeof before calling: `if (typeof f === 'number') validateFrame(...)`.
- Tighten the source type so frame is `number` end-to-end.
- Use a schema validator (zod/etc.) on inbound data to coerce frame to number.
Example fix
// before
const frame = new URLSearchParams(location.search).get('frame');
player.seekTo(frame); // string
// after
const frame = Number(new URLSearchParams(location.search).get('frame'));
player.seekTo(frame); Defensive patterns
Strategy: type-guard
Validate before calling
if (typeof frame !== 'number') {
frame = Number(frame);
}
validateFrame({ frame, durationInFrames, allowFloats }); Type guard
const isNumericFrame = (f: unknown): f is number => typeof f === 'number';
Prevention
- Convert string sources (URL params, JSON, dataset) to Number before passing.
- Type frame as number end-to-end; avoid `any`.
- Validate inbound data with a schema that coerces numeric fields.
When it happens
Trigger: Passing a string frame (from a query string, dataset attribute, or JSON) without converting; passing an object/array; passing null; passing a value coerced through loose equality.
Common situations: Reading frame from URL search params or localStorage (always strings); deserializing JSON where frame was stored as string; mixing `any`-typed data from APIs; DOM dataset attributes.
Related errors
- Argument missing for parameter "frame"
- You have passed a volume of type ${typeof props.volume} to y
- You have passed a playbackRate of type ${typeof props.playba
- Frame ${frame} is not finite
- Argument for frame must be an integer, but got ${frame}
AI-assisted analysis of remotion-dev/remotion@78fe4bb3fd (2026-08-12).
Data as JSON: /api/errors/14f96f2ada66c9fc.
Report an issue: GitHub.