{"record":{"id":"e49591b9293fe7dc","repo":"remotion-dev/remotion","slug":"cannot-use-frame-frame-duration-of-composition","errorCode":null,"errorMessage":"Cannot use frame ${frame}: Duration of composition is ${durationInFrames}, therefore the lowest frame that can be rendered is ${-durationInFrames}","messagePattern":"Cannot use frame (.+?): Duration of composition is (.+?), therefore the lowest frame that can be rendered is (.+?)","errorType":"exception","errorClass":"RangeError","httpStatus":null,"severity":"error","filePath":"packages/core/src/validate-frame.ts","lineNumber":31,"sourceCode":"\n\tif (typeof frame !== 'number') {\n\t\tthrow new TypeError(\n\t\t\t`Argument passed for \"frame\" is not a number: ${frame}`,\n\t\t);\n\t}\n\n\tif (!Number.isFinite(frame)) {\n\t\tthrow new RangeError(`Frame ${frame} is not finite`);\n\t}\n\n\tif (frame % 1 !== 0 && !allowFloats) {\n\t\tthrow new RangeError(\n\t\t\t`Argument for frame must be an integer, but got ${frame}`,\n\t\t);\n\t}\n\n\tif (frame < 0 && frame < -durationInFrames) {\n\t\tthrow new RangeError(\n\t\t\t`Cannot use frame ${frame}: Duration of composition is ${durationInFrames}, therefore the lowest frame that can be rendered is ${-durationInFrames}`,\n\t\t);\n\t}\n\n\tif (frame > durationInFrames - 1) {\n\t\tthrow new RangeError(\n\t\t\t`Cannot use frame ${frame}: Duration of composition is ${durationInFrames}, therefore the highest frame that can be rendered is ${\n\t\t\t\tdurationInFrames - 1\n\t\t\t}`,\n\t\t);\n\t}\n};\n","sourceCodeStart":13,"sourceCodeEnd":44,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/core/src/validate-frame.ts#L13-L44","documentation":"validateFrame throws a RangeError when frame is negative AND below the negative duration (-durationInFrames). Remotion permits negative frames (for sequences starting before time 0) down to -durationInFrames; going further back is invalid. The message reports the lowest allowed frame.","triggerScenarios":"Passing a large negative frame for a sequence/offset; computing a relative frame that undershoots; seeking before the start of a negative-offset sequence by more than its length.","commonSituations":"Sequence `from` offsets producing very negative frames; math that subtracts too aggressively; user input of negative seek values beyond the allowed range.","solutions":["Clamp the frame to the allowed minimum: `Math.max(frame, -durationInFrames)`.","Re-check the offset math that produced the negative value.","Validate user-supplied seek values against duration before passing.","Confirm the composition's durationInFrames matches expectations."],"exampleFix":"// before\nseekTo(computedFrame); // computedFrame < -durationInFrames\n\n// after\nconst safeFrame = Math.max(computedFrame, -durationInFrames);\nseekTo(safeFrame);","handlingStrategy":"validation","validationCode":"const safeFrame = Math.max(frame, -durationInFrames);\nvalidateFrame({ frame: safeFrame, durationInFrames, allowFloats });","typeGuard":"const isAboveLowerBound = (f: number, dur: number) => f >= -dur;","tryCatchPattern":null,"preventionTips":["Clamp computed/relative frames against -durationInFrames before seeking.","Validate user-supplied negative seek input.","Double-check sequence `from` offsets that produce large negative frames."],"tags":["remotion","frame","validation","rangeerror","bounds","negative"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}