{"record":{"id":"ad952b869ef7d219","repo":"remotion-dev/remotion","slug":"startfrom-prop-can-not-be-nan-or-infinity","errorCode":null,"errorMessage":"startFrom prop can not be NaN or Infinity.","messagePattern":"startFrom prop can not be NaN or Infinity\\.","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"packages/core/src/validate-start-from-props.ts","lineNumber":13,"sourceCode":"export const validateStartFromProps = (\n\tstartFrom: number | undefined,\n\tendAt: number | undefined,\n) => {\n\tif (typeof startFrom !== 'undefined') {\n\t\tif (typeof startFrom !== 'number') {\n\t\t\tthrow new TypeError(\n\t\t\t\t`type of startFrom prop must be a number, instead got type ${typeof startFrom}.`,\n\t\t\t);\n\t\t}\n\n\t\tif (isNaN(startFrom) || startFrom === Infinity) {\n\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.');","sourceCodeStart":1,"sourceCodeEnd":31,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/core/src/validate-start-from-props.ts#L1-L31","documentation":"Even when startFrom is a number, validateStartFromProps rejects NaN and Infinity because neither represents a valid frame offset. NaN usually results from a failed Number() conversion or an arithmetic error; Infinity results from division by zero. Both would produce undefined playback behavior downstream.","triggerScenarios":"Passing startFrom={NaN} (e.g. from Number('abc')), startFrom={Infinity} (e.g. from 1/0), or any expression that evaluates to NaN/Infinity.","commonSituations":"Parsing a user-supplied or CMS-supplied string with Number() that returns NaN; computing startFrom dynamically with division where the divisor can be zero; spreading props from an unvalidated external source.","solutions":["Validate the computed value with Number.isFinite() before passing it: startFrom={isFinite(v) ? v : undefined}.","Fix the upstream parse: use Number(str) only after a regex/parseInt check, or default to 0.","Switch to the non-deprecated trimBefore prop.","Omit the prop when the dynamic value cannot be guaranteed finite."],"exampleFix":"// before\nconst startFrom = Number(userInput); // may be NaN\n<Video src={src} startFrom={startFrom} />\n// after\nconst raw = Number(userInput);\nconst startFrom = Number.isFinite(raw) ? raw : undefined;\n<Video src={src} trimBefore={startFrom} />","handlingStrategy":"validation","validationCode":"if (startFrom !== undefined && !Number.isFinite(startFrom)) {\n  throw new Error('startFrom must be a finite number');\n}","typeGuard":"const isFiniteStartFrom = (v: unknown): v is number =>\n  typeof v === 'number' && Number.isFinite(v) && v >= 0;","tryCatchPattern":null,"preventionTips":["Always validate parsed numbers with Number.isFinite() before assigning to startFrom/trimBefore.","Avoid division that can yield Infinity; guard divisors against zero.","Prefer trimBefore over the deprecated startFrom."],"tags":["validation","props","deprecated","nan","infinity","trimming"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}