{"record":{"id":"3ff3397506b69bb7","repo":"remotion-dev/remotion","slug":"ext-x-media-sequence-directive-must-have-a-value","errorCode":null,"errorMessage":"#EXT-X-MEDIA-SEQUENCE directive must have a value","messagePattern":"#EXT-X-MEDIA-SEQUENCE directive must have a value","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/media-parser/src/containers/m3u/parse-directive.ts","lineNumber":81,"sourceCode":"\t\treturn {\n\t\t\ttype: 'm3u-endlist',\n\t\t};\n\t}\n\n\tif (directive === '#EXT-X-PLAYLIST-TYPE') {\n\t\tif (!value) {\n\t\t\tthrow new Error('#EXT-X-PLAYLIST-TYPE. directive must have a value');\n\t\t}\n\n\t\treturn {\n\t\t\ttype: 'm3u-playlist-type',\n\t\t\tplaylistType: value,\n\t\t};\n\t}\n\n\tif (directive === '#EXT-X-MEDIA-SEQUENCE') {\n\t\tif (!value) {\n\t\t\tthrow new Error('#EXT-X-MEDIA-SEQUENCE directive must have a value');\n\t\t}\n\n\t\treturn {\n\t\t\ttype: 'm3u-media-sequence',\n\t\t\tvalue: Number(value),\n\t\t};\n\t}\n\n\tif (directive === '#EXT-X-DISCONTINUITY-SEQUENCE') {\n\t\tif (!value) {\n\t\t\tthrow new Error(\n\t\t\t\t'#EXT-X-DISCONTINUITY-SEQUENCE directive must have a value',\n\t\t\t);\n\t\t}\n\n\t\treturn {\n\t\t\ttype: 'm3u-discontinuity-sequence',\n\t\t\tvalue: Number(value),","sourceCodeStart":63,"sourceCodeEnd":99,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/media-parser/src/containers/m3u/parse-directive.ts#L63-L99","documentation":"Thrown by parseM3uDirective() at parse-directive.ts:81 when a line matches #EXT-X-MEDIA-SEQUENCE but has no numeric value. This directive indicates the sequence number of the first URI in the playlist and is REQUIRED when it is present (RFC 8216 section 4.3.3.2). The parser converts the value via Number().","triggerScenarios":"A playlist line '#EXT-X-MEDIA-SEQUENCE' with no colon, or '#EXT-X-MEDIA-SEQUENCE:' with an empty or non-numeric value.","commonSituations":"Hand-edited or corrupted playlist where the sequence number was removed; encoder bug; playlist truncated after the directive name.","solutions":["Ensure the directive carries a non-negative integer: #EXT-X-MEDIA-SEQUENCE:0","Regenerate the playlist with a compliant HLS packager","Verify the playlist response was not truncated"],"exampleFix":"// before\n#EXT-X-MEDIA-SEQUENCE\n\n// after\n#EXT-X-MEDIA-SEQUENCE:0","handlingStrategy":"validation","validationCode":"// Pre-fetch and check EXT-X-MEDIA-SEQUENCE 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-MEDIA-SEQUENCE')) {\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-MEDIA-SEQUENCE 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-MEDIA-SEQUENCE')) {\n    // fix the playlist source\n  }\n  throw e;\n}","preventionTips":["Ensure media playlists include a valid sequence number in #EXT-X-MEDIA-SEQUENCE","Use a compliant packager to generate well-formed playlists"],"tags":["hls","m3u8","directive","ext-x-media-sequence","malformed"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}