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 lowest frame that can be rendered is ${-durationInFrames}

What it means

validateFrame throws a RangeError when frame is negative AND below the negative duration (-durationInFrames). Remotion permits negative frames (for sequences starting before time 0) down to -durationInFrames; going further back is invalid. The message reports the lowest allowed frame.

Source

Thrown at packages/core/src/validate-frame.ts:31

	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}`,
		);
	}

	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

  1. Clamp the frame to the allowed minimum: `Math.max(frame, -durationInFrames)`.
  2. Re-check the offset math that produced the negative value.
  3. Validate user-supplied seek values against duration before passing.
  4. Confirm the composition's durationInFrames matches expectations.

Example fix

// before
seekTo(computedFrame); // computedFrame < -durationInFrames

// after
const safeFrame = Math.max(computedFrame, -durationInFrames);
seekTo(safeFrame);
Defensive patterns

Strategy: validation

Validate before calling

const safeFrame = Math.max(frame, -durationInFrames);
validateFrame({ frame: safeFrame, durationInFrames, allowFloats });

Type guard

const isAboveLowerBound = (f: number, dur: number) => f >= -dur;

Prevention

When it happens

Trigger: Passing a large negative frame for a sequence/offset; computing a relative frame that undershoots; seeking before the start of a negative-offset sequence by more than its length.

Common situations: Sequence `from` offsets producing very negative frames; math that subtracts too aggressively; user input of negative seek values beyond the allowed range.

Related errors


AI-assisted analysis of remotion-dev/remotion@78fe4bb3fd (2026-08-12). Data as JSON: /api/errors/e49591b9293fe7dc. Report an issue: GitHub.