{"record":{"id":"c75b06a3ec45db9c","repo":"remotion-dev/remotion","slug":"path-endms-must-be-a-finite-non-negative-numbe","errorCode":null,"errorMessage":"${path}.endMs must be a finite, non-negative number.","messagePattern":"(.+?)\\.endMs must be a finite, non-negative number\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/studio/src/components/parse-caption-file.ts","lineNumber":51,"sourceCode":"\t}\n\n\tlet previousStart: number | null = null;\n\tfor (const [index, caption] of parsed.entries()) {\n\t\tconst path = `captions[${index}]`;\n\t\tif (!isObject(caption)) {\n\t\t\tthrow new Error(`${path} must be an object.`);\n\t\t}\n\n\t\tif (typeof caption.text !== 'string') {\n\t\t\tthrow new Error(`${path}.text must be a string.`);\n\t\t}\n\n\t\tif (!isFiniteNumber(caption.startMs) || caption.startMs < 0) {\n\t\t\tthrow new Error(`${path}.startMs must be a finite, non-negative number.`);\n\t\t}\n\n\t\tif (!isFiniteNumber(caption.endMs) || caption.endMs < 0) {\n\t\t\tthrow new Error(`${path}.endMs must be a finite, non-negative number.`);\n\t\t}\n\n\t\tif (caption.endMs < caption.startMs) {\n\t\t\tthrow new Error(`${path}.endMs must not be earlier than startMs.`);\n\t\t}\n\n\t\tif (caption.timestampMs !== null && !isFiniteNumber(caption.timestampMs)) {\n\t\t\tthrow new Error(`${path}.timestampMs must be a finite number or null.`);\n\t\t}\n\n\t\tif (caption.confidence !== null && !isFiniteNumber(caption.confidence)) {\n\t\t\tthrow new Error(`${path}.confidence must be a finite number or null.`);\n\t\t}\n\n\t\tif (\n\t\t\ttypeof caption.confidence === 'number' &&\n\t\t\t(caption.confidence < 0 || caption.confidence > 1)\n\t\t) {","sourceCodeStart":33,"sourceCodeEnd":69,"githubUrl":"https://github.com/remotion-dev/remotion/blob/b2f4e34732f3c6c222ea029413e22dc402218cd7/packages/studio/src/components/parse-caption-file.ts#L33-L69","documentation":"parseCaptionFile requires each caption's endMs to be a finite, non-negative number (checked with isFiniteNumber). NaN, Infinity, negative values, or missing/non-numeric endMs fields in a captions JSON file trigger this error with the offending caption's index path.","triggerScenarios":"captions[i].endMs is absent, a string, NaN, Infinity, or < 0 when parseCaptionFile iterates the array.","commonSituations":"Open-ended cues exported with endMs: null or omitted (e.g. from SRT-like sources); times in seconds not ms; transcription tool emitting Infinity.","solutions":["Provide endMs as a finite number of milliseconds","Replace null/-1/Infinity with an actual end time","Convert seconds to milliseconds"],"exampleFix":"// before\n{\"text\": \"hi\", \"startMs\": 0, \"endMs\": null}\n// after\n{\"text\": \"hi\", \"startMs\": 0, \"endMs\": 1200}","handlingStrategy":"validation","validationCode":"for (const [i, c] of parsed.entries()) {\n  const e = (c as any).endMs;\n  if (typeof e !== 'number' || !Number.isFinite(e) || e < 0) {\n    throw new Error(`captions[${i}].endMs must be a finite non-negative number`);\n  }\n}","typeGuard":"const isValidEndMs = (v: unknown): v is number =>\n  typeof v === 'number' && Number.isFinite(v) && v >= 0;","tryCatchPattern":"try {\n  const captions = parseCaptionFile({fileName, contents});\n} catch (e) {\n  // give open-ended cues a concrete endMs before retrying\n}","preventionTips":["Materialize end times for open-ended cues instead of null/-1","Convert seconds to milliseconds at export time","Validate with Number.isFinite before serializing"],"tags":["json","validation","captions"],"backgroundTag":"invalid-argument-value","analyzedSha":"b2f4e34732f3c6c222ea029413e22dc402218cd7","analyzedAt":"2026-09-09T13:27:51.281Z","contentChangedAt":"2026-09-09T13:27:51.281Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}