{"record":{"id":"53cbc9fb16014513","repo":"remotion-dev/remotion","slug":"the-durationinframes-prop-component-must-be-p","errorCode":null,"errorMessage":"The \"durationInFrames\" prop ${component} must be positive, but got ${durationInFrames}.","messagePattern":"The \"durationInFrames\" prop (.+?) must be positive, but got (.+?)\\.","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"packages/core/src/validation/validate-duration-in-frames.ts","lineNumber":20,"sourceCode":"\tdurationInFrames: unknown,\n\toptions: {\n\t\tcomponent: string;\n\t\tallowFloats: boolean;\n\t},\n): asserts durationInFrames is number {\n\tconst {allowFloats, component} = options;\n\tif (typeof durationInFrames === 'undefined') {\n\t\tthrow new Error(`The \"durationInFrames\" prop ${component} is missing.`);\n\t}\n\n\tif (typeof durationInFrames !== 'number') {\n\t\tthrow new Error(\n\t\t\t`The \"durationInFrames\" prop ${component} must be a number, but you passed a value of type ${typeof durationInFrames}`,\n\t\t);\n\t}\n\n\tif (durationInFrames <= 0) {\n\t\tthrow new TypeError(\n\t\t\t`The \"durationInFrames\" prop ${component} must be positive, but got ${durationInFrames}.`,\n\t\t);\n\t}\n\n\tif (!allowFloats && durationInFrames % 1 !== 0) {\n\t\tthrow new TypeError(\n\t\t\t`The \"durationInFrames\" prop ${component} must be an integer, but got ${durationInFrames}.`,\n\t\t);\n\t}\n\n\tif (!Number.isFinite(durationInFrames)) {\n\t\tthrow new TypeError(\n\t\t\t`The \"durationInFrames\" prop ${component} must be finite, but got ${durationInFrames}.`,\n\t\t);\n\t}\n}\n","sourceCodeStart":2,"sourceCodeEnd":37,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/core/src/validation/validate-duration-in-frames.ts#L2-L37","documentation":"`validateDurationInFrames` rejects `durationInFrames <= 0`. A composition must last at least one frame. This is a TypeError raised after the type check.","triggerScenarios":"Passing `durationInFrames={0}` or a negative number to `<Composition>`, `<Series.Sequence>`, or `<Loop>`; or computing a negative duration from a subtraction.","commonSituations":"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.","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."],"exampleFix":"// before\n<Composition durationInFrames={end - start} ... /> // can be 0 or negative\n// after\nconst dur = Math.max(1, end - start);\n<Composition durationInFrames={dur} ... />","handlingStrategy":"validation","validationCode":"if (d <= 0) { throw new Error('duration must be > 0'); }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Clamp computed durations to a minimum of 1.","Guard subtraction-based durations against overshoot."],"tags":["validation","composition","duration","positive","series","loop"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}