remotion-dev/remotion · error · TypeError
The "trimBefore" prop of <Sequence /> must be greater than o
Error message
The "trimBefore" prop of <Sequence /> must be greater than or equal to 0, but got ${trimBefore}. What it means
Thrown when <Sequence> receives a trimBefore value less than 0. Negative trimming is meaningless (you cannot trim frames before the sequence start), so Remotion rejects it.
Source
Thrown at packages/core/src/Sequence.tsx:237
throw new TypeError(
`You passed to the "from" props of your <Sequence> an argument of type ${typeof from}, but it must be a number.`,
);
}
if (!Number.isFinite(from)) {
throw new TypeError(
`The "from" prop of a sequence must be finite, but got ${from}.`,
);
}
if (typeof trimBefore !== 'number') {
throw new TypeError(
`You passed to the "trimBefore" prop of your <Sequence> an argument of type ${typeof trimBefore}, but it must be a number.`,
);
}
if (trimBefore < 0) {
throw new TypeError(
`The "trimBefore" prop of <Sequence /> must be greater than or equal to 0, but got ${trimBefore}.`,
);
}
if (Number.isNaN(trimBefore)) {
throw new TypeError(
'The "trimBefore" prop of <Sequence /> must be a real number, but it is NaN.',
);
}
if (!Number.isFinite(trimBefore)) {
throw new TypeError(
`The "trimBefore" prop of <Sequence /> must be finite, but it is ${trimBefore}.`,
);
}
if (typeof freeze !== 'undefined' && freeze !== null) {
if (typeof freeze !== 'number') {View on GitHub (pinned to 78fe4bb3fd)
Solutions
- Clamp trimBefore to a minimum of 0: trimBefore={Math.max(0, value)}.
- Re-check the formula producing trimBefore; ensure the subtrahend never exceeds the minuend.
- Add a runtime assertion at the call site before rendering.
Example fix
// before
<Sequence from={10} trimBefore={start - offset} />
// after
<Sequence from={10} trimBefore={Math.max(0, start - offset)} /> Defensive patterns
Strategy: validation
Validate before calling
const trim = Math.max(0, Number(rawTrimBefore));
<Sequence trimBefore={trim} /> Type guard
const isNonNegativeFinite = (v: unknown): v is number => typeof v === 'number' && Number.isFinite(v) && v >= 0;
Prevention
- Clamp derived trim values with Math.max(0, ...) at the call site.
- Unit-test offset arithmetic with edge cases where offset exceeds start.
When it happens
Trigger: Passing a computed trimBefore that went negative (e.g. trimBefore = from - offset where offset > from), or arithmetic underflow from subtracting timestamps.
Common situations: Deriving trimBefore from user-controlled offsets, misordered start/end props, off-by-one in seek calculations, negative results from Math.round on small negatives.
Related errors
- The layout prop of <Sequence /> expects either "absolute-fil
- The cropLeft, cropRight, cropTop and cropBottom props of <Se
- If layout="none", you may not pass a style. Passed: ${JSON.s
- You passed to durationInFrames an argument of type ${typeof
- durationInFrames must be positive, but got ${durationInFrame
AI-assisted analysis of remotion-dev/remotion@78fe4bb3fd (2026-08-12).
Data as JSON: /api/errors/8741be70357850b0.
Report an issue: GitHub.