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
- Pass a positive frame number: endAt={200}.
- Clamp the computed value to at least 1: endAt={Math.max(1, computed)}.
- Verify the duration math that produces endAt; ensure the source media is long enough.
- 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
- Clamp computed end frames with Math.max(1, value).
- Default unset variables to undefined, not 0, so they are skipped rather than rejected.
- Prefer trimAfter over the deprecated endAt.
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
- startFrom must be greater than equal to 0 instead got ${star
- endAt prop must be greater than startFrom prop.
- type of startFrom prop must be a number, instead got type ${
- startFrom prop can not be NaN or Infinity.
- type of endAt prop must be a number, instead got type ${type
AI-assisted analysis of remotion-dev/remotion@78fe4bb3fd (2026-08-12).
Data as JSON: /api/errors/94a9288343daa5cf.
Report an issue: GitHub.