remotion-dev/remotion · error · Error

Expected m3u-text-value

Error message

Expected m3u-text-value

What it means

Thrown by getChunks() while iterating a media playlist's boxes. Per RFC 8216 every #EXTINF directive must be immediately followed by a media segment URI line. The parser stores EXTINF as an m3u-extinf box and the URI as an m3u-text-value box. At get-chunks.ts:21 it asserts that the box following m3u-extinf is of type m3u-text-value; if it is not (missing, wrong type, or playlist ended), parsing aborts.

Source

Thrown at packages/media-parser/src/containers/m3u/get-chunks.ts:22

	duration: number;
	url: string;
	isHeader: boolean;
};

export const getChunks = (playlist: M3uPlaylist) => {
	const chunks: M3uChunk[] = [];
	for (let i = 0; i < playlist.boxes.length; i++) {
		const box = playlist.boxes[i];
		if (box.type === 'm3u-map') {
			chunks.push({duration: 0, url: box.value, isHeader: true});
			continue;
		}

		if (box.type === 'm3u-extinf') {
			const nextBox = playlist.boxes[i + 1];
			i++;
			if (nextBox.type !== 'm3u-text-value') {
				throw new Error('Expected m3u-text-value');
			}

			chunks.push({duration: box.value, url: nextBox.value, isHeader: false});
		}

		continue;
	}

	return chunks;
};

View on GitHub (pinned to 78fe4bb3fd)

Solutions

  1. Verify the media playlist is complete — every #EXTINF line must have a segment URI on the next line
  2. Retry the fetch to rule out transient network truncation of the playlist response
  3. Validate the playlist with an HLS conformance tool (e.g. hlsverify, mediabunny) before parsing
Defensive patterns

Strategy: try-catch

Validate before calling

// Pre-fetch the media playlist text and verify every EXTINF is followed by a URI
const text = await (await fetch(playlistUrl)).text();
const lines = text.split('\n');
for (let i = 0; i < lines.length; i++) {
  if (lines[i].startsWith('#EXTINF')) {
    if (i + 1 >= lines.length || !lines[i + 1].trim() || lines[i + 1].startsWith('#')) {
      throw new Error('Playlist has EXTINF without a following segment URI');
    }
  }
}

Try / catch

try {
  await parseMedia({src: mediaPlaylistUrl});
} catch (e) {
  if (e instanceof Error && e.message === 'Expected m3u-text-value') {
    // the media playlist is malformed or truncated — retry or reject
  }
  throw e;
}

Prevention

When it happens

Trigger: A media playlist where #EXTINF is the last line with no segment URI following it; a directive or comment line appearing between #EXTINF and its segment URL; or a playlist truncated mid-way so the text-value box was never emitted by the line parser.

Common situations: Truncated HTTP response when fetching the media playlist (network timeout, proxy cutting the connection); hand-edited m3u8 files with misplaced lines; live playlists served incomplete during a rolling-window boundary.

Related errors


AI-assisted analysis of remotion-dev/remotion@78fe4bb3fd (2026-08-12). Data as JSON: /api/errors/67a2e9da537e181c. Report an issue: GitHub.