remotion-dev/remotion · error · TypeError
type of endAt prop must be a number, instead got type ${type
Error message
type of endAt prop must be a number, instead got type ${typeof endAt}. What it means
The deprecated `endAt` prop on media components specifies the frame at which playback should stop, and it must be a number. validateStartFromProps checks the runtime type because values destructured from props, configs, or JSON may arrive as strings rather than numbers.
Source
Thrown at packages/core/src/validate-start-from-props.ts:25
throw new TypeError(
`type of startFrom prop must be a number, instead got type ${typeof startFrom}.`,
);
}
if (isNaN(startFrom) || startFrom === Infinity) {
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.');
}View on GitHub (pinned to 78fe4bb3fd)
Solutions
- Pass endAt as a numeric literal: endAt={200}.
- If the value is a string, parse it: endAt={Number(myStr)} after a finiteness check.
- Migrate to the non-deprecated `trimAfter` prop, which has the same semantics.
- Omit the prop if you do not need to cap the end.
Example fix
// before
<Audio src={src} endAt="180" />
// after
<Audio src={src} trimAfter={180} /> Defensive patterns
Strategy: type-guard
Validate before calling
if (endAt !== undefined && typeof endAt !== 'number') {
throw new Error('endAt must be a number or undefined');
} Type guard
const isEndAt = (v: unknown): v is number | undefined => v === undefined || typeof v === 'number';
Prevention
- Migrate from endAt to the non-deprecated trimAfter to avoid future removal.
- Parse string sources with Number() and validate before passing.
- Type scene/config descriptors so numbers are not serialized as strings.
When it happens
Trigger: Passing endAt as a string (endAt="200"), an object, or any non-number non-undefined value to a media component.
Common situations: Reading endAt from a JSON scene descriptor or CMS where numbers are serialized as strings; passing a value from URL query params without conversion.
Related errors
- type of startFrom prop must be a number, instead got type ${
- startFrom prop can not be NaN or Infinity.
- startFrom must be greater than equal to 0 instead got ${star
- endAt prop can not be NaN.
- endAt must be a positive number, instead got ${endAt}.
AI-assisted analysis of remotion-dev/remotion@78fe4bb3fd (2026-08-12).
Data as JSON: /api/errors/652e7621f6531f2a.
Report an issue: GitHub.