{"record":{"id":"aa07210fe32e8ae9","repo":"remotion-dev/remotion","slug":"endat-prop-can-not-be-nan","errorCode":null,"errorMessage":"endAt prop can not be NaN.","messagePattern":"endAt prop can not be NaN\\.","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"packages/core/src/validate-start-from-props.ts","lineNumber":31,"sourceCode":"\t\t\tthrow new TypeError('startFrom prop can not be NaN or Infinity.');\n\t\t}\n\n\t\tif (startFrom < 0) {\n\t\t\tthrow new TypeError(\n\t\t\t\t`startFrom must be greater than equal to 0 instead got ${startFrom}.`,\n\t\t\t);\n\t\t}\n\t}\n\n\tif (typeof endAt !== 'undefined') {\n\t\tif (typeof endAt !== 'number') {\n\t\t\tthrow new TypeError(\n\t\t\t\t`type of endAt prop must be a number, instead got type ${typeof endAt}.`,\n\t\t\t);\n\t\t}\n\n\t\tif (isNaN(endAt)) {\n\t\t\tthrow new TypeError('endAt prop can not be NaN.');\n\t\t}\n\n\t\tif (endAt <= 0) {\n\t\t\tthrow new TypeError(\n\t\t\t\t`endAt must be a positive number, instead got ${endAt}.`,\n\t\t\t);\n\t\t}\n\t}\n\n\tif ((endAt as number) < (startFrom as number)) {\n\t\tthrow new TypeError('endAt prop must be greater than startFrom prop.');\n\t}\n};\n\nexport const validateTrimProps = (\n\ttrimBefore: number | undefined,\n\ttrimAfter: number | undefined,\n) => {","sourceCodeStart":13,"sourceCodeEnd":49,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/core/src/validate-start-from-props.ts#L13-L49","documentation":"validateStartFromProps rejects NaN for the deprecated endAt prop because NaN cannot represent a valid end frame and would silently break the stop-time calculation. Note: unlike startFrom/trimBefore, endAt allows Infinity is NOT checked here (only NaN is), but NaN is always invalid.","triggerScenarios":"Passing endAt={NaN}, typically the result of Number('abc'), an undefined arithmetic result, or parseFloat on a non-numeric string.","commonSituations":"Parsing an end timestamp from user input or a CMS with Number()/parseFloat() that yields NaN; computing endAt from a duration that is itself undefined.","solutions":["Guard the parsed value with Number.isFinite() before passing it.","Fix the upstream string-to-number conversion (validate input format first).","Migrate to the non-deprecated trimAfter prop (same NaN rejection applies).","Omit the prop if the dynamic value cannot be guaranteed to be a valid number."],"exampleFix":"// before\nconst endAt = Number(rawEnd); // NaN if rawEnd is non-numeric\n<Video src={src} endAt={endAt} />\n// after\nconst parsed = Number(rawEnd);\nconst endAt = Number.isFinite(parsed) ? parsed : undefined;\n<Video src={src} trimAfter={endAt} />","handlingStrategy":"validation","validationCode":"if (endAt !== undefined && Number.isNaN(endAt)) {\n  throw new Error('endAt must not be NaN');\n}","typeGuard":"const isValidEndAt = (v: unknown): v is number =>\n  typeof v === 'number' && !Number.isNaN(v);","tryCatchPattern":null,"preventionTips":["Guard parsed values with Number.isFinite() before assigning to endAt/trimAfter.","Validate the format of user/CMS input before Number()/parseFloat().","Prefer trimAfter over the deprecated endAt."],"tags":["validation","props","deprecated","nan","trimming"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}