remotion-dev/remotion · error · TypeError
The "durationInFrames" prop ${component} must be positive, b
Error message
The "durationInFrames" prop ${component} must be positive, but got ${durationInFrames}. What it means
`validateDurationInFrames` rejects `durationInFrames <= 0`. A composition must last at least one frame. This is a TypeError raised after the type check.
Source
Thrown at packages/core/src/validation/validate-duration-in-frames.ts:20
durationInFrames: unknown,
options: {
component: string;
allowFloats: boolean;
},
): asserts durationInFrames is number {
const {allowFloats, component} = options;
if (typeof durationInFrames === 'undefined') {
throw new Error(`The "durationInFrames" prop ${component} is missing.`);
}
if (typeof durationInFrames !== 'number') {
throw new Error(
`The "durationInFrames" prop ${component} must be a number, but you passed a value of type ${typeof durationInFrames}`,
);
}
if (durationInFrames <= 0) {
throw new TypeError(
`The "durationInFrames" prop ${component} must be positive, but got ${durationInFrames}.`,
);
}
if (!allowFloats && durationInFrames % 1 !== 0) {
throw new TypeError(
`The "durationInFrames" prop ${component} must be an integer, but got ${durationInFrames}.`,
);
}
if (!Number.isFinite(durationInFrames)) {
throw new TypeError(
`The "durationInFrames" prop ${component} must be finite, but got ${durationInFrames}.`,
);
}
}
View on GitHub (pinned to 78fe4bb3fd)
Solutions
- Ensure duration is at least 1: `Math.max(1, value)`.
- Validate `> 0` before passing.
- Treat 0 as 'no content' and skip the segment rather than rendering it.
Example fix
// before
<Composition durationInFrames={end - start} ... /> // can be 0 or negative
// after
const dur = Math.max(1, end - start);
<Composition durationInFrames={dur} ... /> Defensive patterns
Strategy: validation
Validate before calling
if (d <= 0) { throw new Error('duration must be > 0'); } Prevention
- Clamp computed durations to a minimum of 1.
- Guard subtraction-based durations against overshoot.
When it happens
Trigger: Passing `durationInFrames={0}` or a negative number to `<Composition>`, `<Series.Sequence>`, or `<Loop>`; or computing a negative duration from a subtraction.
Common situations: A data-driven duration that rounds down to 0 for very short segments; `durationInFrames={end - start}` where `start >= end`; a default of 0 as a placeholder.
Related errors
- The "durationInFrames" prop ${component} is missing.
- The "durationInFrames" prop ${component} must be a number, b
- The "durationInFrames" prop ${component} must be finite, but
- The "${nameOfProp}" prop ${location} must be positive, but g
- The "durationInFrames" prop ${component} must be an integer,
AI-assisted analysis of remotion-dev/remotion@78fe4bb3fd (2026-08-12).
Data as JSON: /api/errors/53cbc9fb16014513.
Report an issue: GitHub.