remotion-dev/remotion · error · RangeError
Cannot use frame ${frame}: Duration of composition is ${dura
Error message
Cannot use frame ${frame}: Duration of composition is ${durationInFrames}, therefore the highest frame that can be rendered is ${durationInFrames - 1} What it means
validateFrame throws a RangeError when frame exceeds durationInFrames - 1 (the last valid frame). This is the upper-bound counterpart to 374. The message reports the highest allowed frame. It guards rendering and seeking against out-of-range positive frames.
Source
Thrown at packages/core/src/validate-frame.ts:37
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}`,
);
}
if (frame > durationInFrames - 1) {
throw new RangeError(
`Cannot use frame ${frame}: Duration of composition is ${durationInFrames}, therefore the highest frame that can be rendered is ${
durationInFrames - 1
}`,
);
}
};
View on GitHub (pinned to 78fe4bb3fd)
Solutions
- Clamp to the last frame: `Math.min(frame, durationInFrames - 1)`.
- Verify the durationInFrames used in the call matches the composition's actual duration.
- Use modulo for loops: `frame % durationInFrames`.
- Validate user seek input against duration before calling.
Example fix
// before seekTo(targetFrame); // targetFrame > durationInFrames - 1 // after const safeFrame = Math.min(targetFrame, durationInFrames - 1); seekTo(safeFrame);
Defensive patterns
Strategy: validation
Validate before calling
const safeFrame = Math.min(frame, durationInFrames - 1);
validateFrame({ frame: safeFrame, durationInFrames, allowFloats }); Type guard
const isBelowUpperBound = (f: number, dur: number) => f <= dur - 1;
Prevention
- Clamp seeks to durationInFrames - 1.
- Use modulo for loops: frame % durationInFrames.
- Confirm the duration used at the call site matches the composition's duration.
When it happens
Trigger: Seeking past the end of the composition; computing frame from a time value beyond duration; off-by-one in loop math; passing absolute frame when a relative frame was expected.
Common situations: Looping logic that increments frame past the end; interpolation/extrapolation that overshoots; user scrubbing beyond duration; mismatched durationInFrames between caller and composition.
Related errors
- Cannot use frame ${frame}: Duration of composition is ${dura
- Frame ${frame} is not finite
- Argument for frame must be an integer, but got ${frame}
- Argument missing for parameter "frame"
- Argument passed for "frame" is not a number: ${frame}
AI-assisted analysis of remotion-dev/remotion@78fe4bb3fd (2026-08-12).
Data as JSON: /api/errors/b14ba309837ee172.
Report an issue: GitHub.