{"record":{"id":"70376004b9f235d9","repo":"remotion-dev/remotion","slug":"path-confidence-must-be-between-0-and-1","errorCode":null,"errorMessage":"${path}.confidence must be between 0 and 1.","messagePattern":"(.+?)\\.confidence must be between 0 and 1\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/studio/src/components/parse-caption-file.ts","lineNumber":70,"sourceCode":"\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) {\n\t\t\tthrow new Error(`${path}.confidence must be between 0 and 1.`);\n\t\t}\n\n\t\tif (\n\t\t\tcaption.pageBreakAfter !== undefined &&\n\t\t\ttypeof caption.pageBreakAfter !== 'boolean'\n\t\t) {\n\t\t\tthrow new Error(\n\t\t\t\t`${path}.pageBreakAfter must be a boolean when provided.`,\n\t\t\t);\n\t\t}\n\n\t\tif (previousStart !== null && caption.startMs < previousStart) {\n\t\t\tthrow new Error(`${path}.startMs is out of timestamp order.`);\n\t\t}\n\n\t\tpreviousStart = caption.startMs;\n\t}\n","sourceCodeStart":52,"sourceCodeEnd":88,"githubUrl":"https://github.com/remotion-dev/remotion/blob/b2f4e34732f3c6c222ea029413e22dc402218cd7/packages/studio/src/components/parse-caption-file.ts#L52-L88","documentation":"parseCaptionFile requires that when a caption's confidence is a number, it lies between 0 and 1 inclusive. Values outside that range (e.g. percentages like 95 instead of 0.95) are rejected with the offending caption's index path.","triggerScenarios":"captions[i].confidence is 95 (a percentage) or 1.5 — the parse succeeded as a number but fails the 0..1 range check.","commonSituations":"ASR exports using 0-100 percentage scale; multiplying a probability twice; manual entry of percent values.","solutions":["Divide percentage values by 100: 95 -> 0.95","Clamp confidence to [0, 1] in the export script","Set confidence to null if the scale is unknown"],"exampleFix":"// before\n{\"text\": \"hi\", \"startMs\": 0, \"endMs\": 1000, \"confidence\": 95}\n// after\n{\"text\": \"hi\", \"startMs\": 0, \"endMs\": 1000, \"confidence\": 0.95}","handlingStrategy":"validation","validationCode":"for (const [i, c] of parsed.entries()) {\n  const conf = (c as any).confidence;\n  if (typeof conf === 'number' && (conf < 0 || conf > 1)) {\n    throw new Error(`captions[${i}].confidence must be between 0 and 1`);\n  }\n}","typeGuard":"const isUnitInterval = (v: unknown): v is number =>\n  typeof v === 'number' && Number.isFinite(v) && v >= 0 && v <= 1;","tryCatchPattern":"try {\n  const captions = parseCaptionFile({fileName, contents});\n} catch (e) {\n  // divide percentages by 100 and retry\n}","preventionTips":["Convert 0-100 percentage confidences to 0-1 before export","Clamp confidence with Math.min(1, Math.max(0, value))","Document the expected 0..1 scale in your export tooling"],"tags":["json","validation","captions"],"backgroundTag":"value-out-of-range","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"}