remotion-dev/remotion · error · Error

Expected m3u-playlist with src ${src}

Error message

Expected m3u-playlist with src ${src}

What it means

Thrown by getPlaylist() at get-playlist.ts:50 when searching getAllPlaylists() output for a playlist whose src string matches the provided src argument. Each fetched playlist is stored with its URL as src; if none matches, the lookup fails. The comparison is strict string equality after createAdjacentFileSource resolves relative URIs against the master playlist URL.

Source

Thrown at packages/media-parser/src/containers/m3u/get-playlist.ts:50

				type: 'm3u-playlist',
				boxes: structure.boxes,
				src,
			},
		];
	}

	return playlists;
};

export const getPlaylist = (
	structure: M3uStructure,
	src: string,
): M3uPlaylist => {
	const allPlaylists = getAllPlaylists({structure, src});

	const playlists = allPlaylists.find((box) => box.src === src);
	if (!playlists) {
		throw new Error(`Expected m3u-playlist with src ${src}`);
	}

	return playlists as M3uPlaylist;
};

export const getDurationFromPlaylist = (playlist: M3uPlaylist): number => {
	const duration = playlist.boxes.filter((box) => box.type === 'm3u-extinf');
	if (duration.length === 0) {
		throw new Error('Expected duration in m3u playlist');
	}

	return duration.reduce((acc, d) => acc + d.value, 0);
};

View on GitHub (pinned to 78fe4bb3fd)

Solutions

  1. Ensure all media playlist URLs in the master playlist resolve to valid, fetchable resources
  2. Check for CORS or 404 errors on sub-playlist fetches that would prevent them from being stored
  3. Verify the src strings are consistent — relative URIs are resolved against the master playlist URL by createAdjacentFileSource
Defensive patterns

Strategy: try-catch

Try / catch

try {
  await parseMedia({src: 'https://cdn.example.com/master.m3u8'});
} catch (e) {
  if (e instanceof Error && e.message.startsWith('Expected m3u-playlist with src')) {
    // a sub-playlist fetch failed or URL resolution mismatch occurred
  }
  throw e;
}

Prevention

When it happens

Trigger: Called internally during process-m3u-chunk when iterating selected playlist URLs. The src passed to getPlaylist doesn't match any stored M3uPlaylist.src because URL resolution (createAdjacentFileSource) produced a different string, or because the media playlist fetch failed silently and was never added to the structure.

Common situations: Relative vs absolute URL mismatches when the master playlist uses relative segment URIs; trailing-slash or query-parameter differences between resolved and stored URLs; a media playlist fetch that failed (404, CORS) and was not added to structure.boxes.

Related errors


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