{"record":{"id":"70e528668b43541d","repo":"remotion-dev/remotion","slug":"you-passed-to-durationinframes-an-argument-of-type","errorCode":null,"errorMessage":"You passed to durationInFrames an argument of type ${typeof durationInFrames}, but it must be a number.","messagePattern":"You passed to durationInFrames an argument of type (.+?), but it must be a number\\.","errorType":"exception","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"packages/core/src/Sequence.tsx","lineNumber":207,"sourceCode":"\n\tvalidateSequenceCrop(cropProps);\n\tconst {\n\t\tleft: resolvedCropLeft,\n\t\tright: resolvedCropRight,\n\t\ttop: resolvedCropTop,\n\t\tbottom: resolvedCropBottom,\n\t} = resolveSequenceCrop(cropProps);\n\t// @ts-expect-error\n\tif (layout === 'none' && typeof other.style !== 'undefined') {\n\t\tthrow new TypeError(\n\t\t\t'If layout=\"none\", you may not pass a style. Passed: ' +\n\t\t\t\t// @ts-expect-error\n\t\t\t\tJSON.stringify(other.style),\n\t\t);\n\t}\n\n\tif (typeof durationInFrames !== 'number') {\n\t\tthrow new TypeError(\n\t\t\t`You passed to durationInFrames an argument of type ${typeof durationInFrames}, but it must be a number.`,\n\t\t);\n\t}\n\n\tif (durationInFrames <= 0) {\n\t\tthrow new TypeError(\n\t\t\t`durationInFrames must be positive, but got ${durationInFrames}`,\n\t\t);\n\t}\n\n\tif (typeof from !== 'number') {\n\t\tthrow new TypeError(\n\t\t\t`You passed to the \"from\" props of your <Sequence> an argument of type ${typeof from}, but it must be a number.`,\n\t\t);\n\t}\n\n\tif (!Number.isFinite(from)) {\n\t\tthrow new TypeError(","sourceCodeStart":189,"sourceCodeEnd":225,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/core/src/Sequence.tsx#L189-L225","documentation":"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.","triggerScenarios":"Passing `durationInFrames=\"30\"` (string), `durationInFrames={undefined}`, or `durationInFrames={null}` to <Sequence>; spreading props that omit durationInFrames; reading from JSON config that yields a string.","commonSituations":"Loading composition config from JSON without coercion; programmatic Sequence generation; default params that resolve to undefined.","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`."],"exampleFix":"// before\n<Sequence durationInFrames={config.duration /* string from JSON */} />\n// after\n<Sequence durationInFrames={Number(config.duration)} />","handlingStrategy":"type-guard","validationCode":"if (typeof durationInFrames !== 'number') {\n  throw new TypeError(`durationInFrames must be a number; got ${typeof durationInFrames}`);\n}","typeGuard":"const isNumber = (v: unknown): v is number => typeof v === 'number';","tryCatchPattern":null,"preventionTips":["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."],"tags":["sequence","duration","props","validation","types"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}