{"record":{"id":"126dbf41b7433035","repo":"remotion-dev/remotion","slug":"path-pagebreakafter-must-be-a-boolean-when-prov","errorCode":null,"errorMessage":"${path}.pageBreakAfter must be a boolean when provided.","messagePattern":"(.+?)\\.pageBreakAfter must be a boolean when provided\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/studio/src/components/parse-caption-file.ts","lineNumber":77,"sourceCode":"\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\n\treturn parsed as Caption[];\n};\n","sourceCodeStart":59,"sourceCodeEnd":91,"githubUrl":"https://github.com/remotion-dev/remotion/blob/b2f4e34732f3c6c222ea029413e22dc402218cd7/packages/studio/src/components/parse-caption-file.ts#L59-L91","documentation":"parseCaptionFile treats pageBreakAfter as optional, but if it is provided it must be a strict boolean. Passing truthy/non-boolean values such as 1, 'true', or null is rejected while validating the indexed caption.","triggerScenarios":"captions[i].pageBreakAfter is defined but typeof !== 'boolean', e.g. pageBreakAfter: \"true\", 0, or 1.","commonSituations":"Tools serializing booleans as strings or 0/1 integers; hand-editing the JSON with \"true\" quoted; config-driven generation using truthy flags.","solutions":["Change the value to a real JSON boolean: true or false (unquoted)","Remove the field entirely if not needed (undefined is allowed)","Fix the exporter to serialize booleans as booleans"],"exampleFix":"// before\n{\"text\": \"hi\", \"startMs\": 0, \"endMs\": 1000, \"pageBreakAfter\": \"true\"}\n// after\n{\"text\": \"hi\", \"startMs\": 0, \"endMs\": 1000, \"pageBreakAfter\": true}","handlingStrategy":"type-guard","validationCode":"for (const [i, c] of parsed.entries()) {\n  const pba = (c as any).pageBreakAfter;\n  if (pba !== undefined && typeof pba !== 'boolean') {\n    throw new Error(`captions[${i}].pageBreakAfter must be a boolean`);\n  }\n}","typeGuard":"const isOptionalBoolean = (v: unknown): v is boolean | undefined =>\n  v === undefined || typeof v === 'boolean';","tryCatchPattern":"try {\n  const captions = parseCaptionFile({fileName, contents});\n} catch (e) {\n  // coerce \"true\"/1 to boolean or drop the field, retry\n}","preventionTips":["Serialize flags as real JSON booleans, not \"true\"/0/1","Omit pageBreakAfter instead of writing null","Enforce TypeScript boolean types in the exporter so they survive JSON.stringify"],"tags":["json","validation","captions"],"backgroundTag":"type-mismatch","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"}