remotion-dev/remotion · error · TypeError

endAt must be a positive number, instead got ${endAt}.

Error message

endAt must be a positive number, instead got ${endAt}.

What it means

The deprecated endAt prop specifies the frame at which playback stops, and it must be strictly positive (greater than 0). validateStartFromProps rejects zero and negative values because an end frame of 0 or below would mean the media never plays.

Source

Thrown at packages/core/src/validate-start-from-props.ts:35

			throw new TypeError(
				`startFrom must be greater than equal to 0 instead got ${startFrom}.`,
			);
		}
	}

	if (typeof endAt !== 'undefined') {
		if (typeof endAt !== 'number') {
			throw new TypeError(
				`type of endAt prop must be a number, instead got type ${typeof endAt}.`,
			);
		}

		if (isNaN(endAt)) {
			throw new TypeError('endAt prop can not be NaN.');
		}

		if (endAt <= 0) {
			throw new TypeError(
				`endAt must be a positive number, instead got ${endAt}.`,
			);
		}
	}

	if ((endAt as number) < (startFrom as number)) {
		throw new TypeError('endAt prop must be greater than startFrom prop.');
	}
};

export const validateTrimProps = (
	trimBefore: number | undefined,
	trimAfter: number | undefined,
) => {
	if (typeof trimBefore !== 'undefined') {
		if (typeof trimBefore !== 'number') {
			throw new TypeError(
				`type of trimBefore prop must be a number, instead got type ${typeof trimBefore}.`,

View on GitHub (pinned to 78fe4bb3fd)

Solutions

  1. Pass a positive frame number: endAt={200}.
  2. Clamp the computed value to at least 1: endAt={Math.max(1, computed)}.
  3. Verify the duration math that produces endAt; ensure the source media is long enough.
  4. Migrate to the non-deprecated trimAfter prop (same positive constraint applies).

Example fix

// before
<Video src={src} endAt={duration - margin} /> // can be <= 0
// after
<Video src={src} trimAfter={Math.max(1, duration - margin)} />
Defensive patterns

Strategy: validation

Validate before calling

if (endAt !== undefined && endAt <= 0) {
  throw new Error('endAt must be > 0');
}

Type guard

const isValidEndAt = (v: unknown): v is number =>
  typeof v === 'number' && !Number.isNaN(v) && v > 0;

Prevention

When it happens

Trigger: Passing endAt={0}, endAt={-5}, or a computed expression that evaluates to zero or a negative number.

Common situations: Setting endAt to 0 by mistake (e.g. defaulting an uninitialized variable to 0); subtracting a margin that drives the end before frame 0; off-by-one when endAt is computed from a duration that collapses to 0.

Related errors


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