remotion-dev/remotion · error · TypeError
You passed to durationInFrames an argument of type ${typeof
Error message
You passed to durationInFrames an argument of type ${typeof durationInFrames}, but it must be a number. What it means
Thrown by <Sequence> when `durationInFrames` is present but not of type 'number' (string, undefined, object, etc.). <Sequence> uses durationInFrames to compute the timeline window and frame clamping; non-numeric values would propagate NaN through the frame math. The check reports the actual type so the caller can see what they passed.
Source
Thrown at packages/core/src/Sequence.tsx:207
validateSequenceCrop(cropProps);
const {
left: resolvedCropLeft,
right: resolvedCropRight,
top: resolvedCropTop,
bottom: resolvedCropBottom,
} = resolveSequenceCrop(cropProps);
// @ts-expect-error
if (layout === 'none' && typeof other.style !== 'undefined') {
throw new TypeError(
'If layout="none", you may not pass a style. Passed: ' +
// @ts-expect-error
JSON.stringify(other.style),
);
}
if (typeof durationInFrames !== 'number') {
throw new TypeError(
`You passed to durationInFrames an argument of type ${typeof durationInFrames}, but it must be a number.`,
);
}
if (durationInFrames <= 0) {
throw new TypeError(
`durationInFrames must be positive, but got ${durationInFrames}`,
);
}
if (typeof from !== 'number') {
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(View on GitHub (pinned to 78fe4bb3fd)
Solutions
- Pass a numeric literal: `durationInFrames={30}`.
- Coerce values loaded from JSON: `durationInFrames={Number(config.duration)}`.
- Type the prop as `number` in your wrapper so TypeScript rejects non-numbers at compile time.
- Default the prop at the caller side: `const duration = config.duration ?? 30`.
Example fix
// before
<Sequence durationInFrames={config.duration /* string from JSON */} />
// after
<Sequence durationInFrames={Number(config.duration)} /> Defensive patterns
Strategy: type-guard
Validate before calling
if (typeof durationInFrames !== 'number') {
throw new TypeError(`durationInFrames must be a number; got ${typeof durationInFrames}`);
} Type guard
const isNumber = (v: unknown): v is number => typeof v === 'number';
Prevention
- Type durationInFrames as `number` (not optional) in Sequence wrappers.
- Coerce JSON/URL params with `Number(value)` before passing.
- Validate config schemas (zod) at the boundary.
- Default to a sane constant when the source is undefined.
When it happens
Trigger: Passing `durationInFrames="30"` (string), `durationInFrames={undefined}`, or `durationInFrames={null}` to <Sequence>; spreading props that omit durationInFrames; reading from JSON config that yields a string.
Common situations: Loading composition config from JSON without coercion; programmatic Sequence generation; default params that resolve to undefined.
Related errors
- You passed to the "from" props of your <Sequence> an argumen
- HtmlInCanvas: `width` and `height` must be numbers. Received
- 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
AI-assisted analysis of remotion-dev/remotion@78fe4bb3fd (2026-08-12).
Data as JSON: /api/errors/70e528668b43541d.
Report an issue: GitHub.