{"record":{"id":"612b0398ea74f0a8","repo":"remotion-dev/remotion","slug":"the-trimbefore-prop-of-sequence-must-be-a-re","errorCode":null,"errorMessage":"The \"trimBefore\" prop of <Sequence /> must be a real number, but it is NaN.","messagePattern":"The \"trimBefore\" prop of <Sequence /> must be a real number, but it is NaN\\.","errorType":"exception","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"packages/core/src/Sequence.tsx","lineNumber":243,"sourceCode":"\t\tthrow new TypeError(\n\t\t\t`The \"from\" prop of a sequence must be finite, but got ${from}.`,\n\t\t);\n\t}\n\n\tif (typeof trimBefore !== 'number') {\n\t\tthrow new TypeError(\n\t\t\t`You passed to the \"trimBefore\" prop of your <Sequence> an argument of type ${typeof trimBefore}, but it must be a number.`,\n\t\t);\n\t}\n\n\tif (trimBefore < 0) {\n\t\tthrow new TypeError(\n\t\t\t`The \"trimBefore\" prop of <Sequence /> must be greater than or equal to 0, but got ${trimBefore}.`,\n\t\t);\n\t}\n\n\tif (Number.isNaN(trimBefore)) {\n\t\tthrow new TypeError(\n\t\t\t'The \"trimBefore\" prop of <Sequence /> must be a real number, but it is NaN.',\n\t\t);\n\t}\n\n\tif (!Number.isFinite(trimBefore)) {\n\t\tthrow new TypeError(\n\t\t\t`The \"trimBefore\" prop of <Sequence /> must be finite, but it is ${trimBefore}.`,\n\t\t);\n\t}\n\n\tif (typeof freeze !== 'undefined' && freeze !== null) {\n\t\tif (typeof freeze !== 'number') {\n\t\t\tthrow new TypeError(\n\t\t\t\t`The \"freeze\" prop of <Sequence /> must be a number, but is of type ${typeof freeze}.`,\n\t\t\t);\n\t\t}\n\n\t\tif (Number.isNaN(freeze)) {","sourceCodeStart":225,"sourceCodeEnd":261,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/core/src/Sequence.tsx#L225-L261","documentation":"Thrown when trimBefore is the literal NaN. Because the prior check (trimBefore < 0) is false for NaN, this guard catches the case explicitly before the finite check. Passing NaN corrupts frame math silently, so it is rejected.","triggerScenarios":"trimBefore is the result of Number(undefined), parseInt(nonNumericString), 0/0, or Math.sqrt(-1).","commonSituations":"Parsing a missing or malformed trimBefore field from config; arithmetic on undefined variables; parseFloat returning NaN on empty strings.","solutions":["Use Number.isFinite(trimBefore) before passing the prop.","Fall back to a default when parsing fails: const tb = Number(raw); if (!Number.isFinite(tb)) tb = 0.","Validate upstream data shape at the config loader."],"exampleFix":"// before\nconst trimBefore = parseInt(config.trim, 10);\n<Sequence trimBefore={trimBefore} />\n\n// after\nconst trimBefore = Number(config.trim);\n<Sequence trimBefore={Number.isFinite(trimBefore) ? trimBefore : 0} />","handlingStrategy":"validation","validationCode":"if (!Number.isFinite(trimBefore)) {\n  trimBefore = 0;\n}","typeGuard":"const isRealNumber = (v: unknown): v is number =>\n  typeof v === 'number' && !Number.isNaN(v);","tryCatchPattern":null,"preventionTips":["Use Number.isFinite to reject NaN and Infinity in one check.","Never pass parseInt results directly without an isNaN guard."],"tags":["sequence","props","nan","validation"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}