remotion-dev/remotion · error · TypeError

endAt prop can not be NaN.

Error message

endAt prop can not be NaN.

What it means

validateStartFromProps rejects NaN for the deprecated endAt prop because NaN cannot represent a valid end frame and would silently break the stop-time calculation. Note: unlike startFrom/trimBefore, endAt allows Infinity is NOT checked here (only NaN is), but NaN is always invalid.

Source

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

			throw new TypeError('startFrom prop can not be NaN or Infinity.');
		}

		if (startFrom < 0) {
			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,
) => {

View on GitHub (pinned to 78fe4bb3fd)

Solutions

  1. Guard the parsed value with Number.isFinite() before passing it.
  2. Fix the upstream string-to-number conversion (validate input format first).
  3. Migrate to the non-deprecated trimAfter prop (same NaN rejection applies).
  4. Omit the prop if the dynamic value cannot be guaranteed to be a valid number.

Example fix

// before
const endAt = Number(rawEnd); // NaN if rawEnd is non-numeric
<Video src={src} endAt={endAt} />
// after
const parsed = Number(rawEnd);
const endAt = Number.isFinite(parsed) ? parsed : undefined;
<Video src={src} trimAfter={endAt} />
Defensive patterns

Strategy: validation

Validate before calling

if (endAt !== undefined && Number.isNaN(endAt)) {
  throw new Error('endAt must not be NaN');
}

Type guard

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

Prevention

When it happens

Trigger: Passing endAt={NaN}, typically the result of Number('abc'), an undefined arithmetic result, or parseFloat on a non-numeric string.

Common situations: Parsing an end timestamp from user input or a CMS with Number()/parseFloat() that yields NaN; computing endAt from a duration that is itself undefined.

Related errors


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