{"record":{"id":"8795f291b82fe507","repo":"remotion-dev/remotion","slug":"ext-x-targetduration-directive-must-have-a-value","errorCode":null,"errorMessage":"EXT-X-TARGETDURATION directive must have a value","messagePattern":"EXT-X-TARGETDURATION directive must have a value","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/media-parser/src/containers/m3u/parse-directive.ts","lineNumber":42,"sourceCode":"\tif (directive === '#EXT-X-INDEPENDENT-SEGMENTS') {\n\t\treturn {\n\t\t\ttype: 'm3u-independent-segments',\n\t\t};\n\t}\n\n\tif (directive === '#EXT-X-MEDIA') {\n\t\tif (!value) {\n\t\t\tthrow new Error('EXT-X-MEDIA directive must have a value');\n\t\t}\n\n\t\tconst parsed = parseM3uMediaDirective(value);\n\n\t\treturn parsed;\n\t}\n\n\tif (directive === '#EXT-X-TARGETDURATION') {\n\t\tif (!value) {\n\t\t\tthrow new Error('EXT-X-TARGETDURATION directive must have a value');\n\t\t}\n\n\t\treturn {\n\t\t\ttype: 'm3u-target-duration',\n\t\t\tduration: parseFloat(value),\n\t\t};\n\t}\n\n\tif (directive === '#EXTINF') {\n\t\tif (!value) {\n\t\t\tthrow new Error('EXTINF has no value');\n\t\t}\n\n\t\treturn {\n\t\t\ttype: 'm3u-extinf',\n\t\t\tvalue: parseFloat(value),\n\t\t};\n\t}","sourceCodeStart":24,"sourceCodeEnd":60,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/media-parser/src/containers/m3u/parse-directive.ts#L24-L60","documentation":"Thrown by parseM3uDirective() at parse-directive.ts:42 when a line matches #EXT-X-TARGETDURATION but has no numeric value. This directive is REQUIRED in every media playlist per RFC 8216 and specifies the maximum media-segment duration in seconds. The parser passes the value through parseFloat(), so it must be present.","triggerScenarios":"A playlist line '#EXT-X-TARGETDURATION' with no colon, or '#EXT-X-TARGETDURATION:' with no number after it.","commonSituations":"Corrupted or hand-edited media playlist missing the required duration value; encoder bug omitting the value; playlist truncated after the directive name.","solutions":["Ensure the directive has a numeric value: #EXT-X-TARGETDURATION:10","Regenerate the playlist with a compliant HLS packager","Verify the media playlist was fully received (no truncation)"],"exampleFix":"// before\n#EXT-X-TARGETDURATION\n\n// after\n#EXT-X-TARGETDURATION:10","handlingStrategy":"validation","validationCode":"// Pre-fetch and check EXT-X-TARGETDURATION has a numeric value\nconst text = await (await fetch(url)).text();\nfor (const line of text.split('\\n')) {\n  const trimmed = line.trim();\n  if (trimmed.startsWith('#EXT-X-TARGETDURATION')) {\n    const colonIdx = trimmed.indexOf(':');\n    const val = colonIdx === -1 ? '' : trimmed.slice(colonIdx + 1).trim();\n    if (!val || isNaN(Number(val))) {\n      throw new Error('#EXT-X-TARGETDURATION is missing its numeric value');\n    }\n  }\n}","typeGuard":null,"tryCatchPattern":"try {\n  await parseMedia({src: url});\n} catch (e) {\n  if (e instanceof Error && e.message.includes('EXT-X-TARGETDURATION')) {\n    // fix the playlist or regenerate with a compliant packager\n  }\n  throw e;\n}","preventionTips":["Ensure media playlists include a valid #EXT-X-TARGETDURATION:seconds directive","Test generated playlists against the RFC 8216 conformance requirements"],"tags":["hls","m3u8","directive","ext-x-targetduration","malformed"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}