remotion-dev/remotion · error · Error
The associated playlist ${JSON.stringify(streams)} cannot be
Error message
The associated playlist ${JSON.stringify(streams)} cannot be selected because it was not in the list of selectable playlists What it means
Thrown by `selectAssociatedPlaylists` when the custom `selectM3uAssociatedPlaylists` callback returns a playlist whose `src` property does not match any playlist in the original selectable list. The callback may only return a subset of the playlists it was given — it cannot invent new playlists or modify their `src` values.
Source
Thrown at packages/media-parser/src/containers/m3u/select-stream.ts:44
skipAudioTracks: boolean;
}): Promise<M3uAssociatedPlaylist[]> => {
if (playlists.length < 1) {
return Promise.resolve([]);
}
const streams = await fn({associatedPlaylists: playlists});
if (!Array.isArray(streams)) {
throw new Error('Expected an array of associated playlists');
}
const selectedStreams: M3uAssociatedPlaylist[] = [];
for (const stream of streams) {
if (stream.isAudio && skipAudioTracks) {
continue;
}
if (!playlists.find((playlist) => playlist.src === stream.src)) {
throw new Error(
`The associated playlist ${JSON.stringify(streams)} cannot be selected because it was not in the list of selectable playlists`,
);
}
selectedStreams.push(stream);
}
return selectedStreams;
};
export const defaultSelectM3uAssociatedPlaylists: SelectM3uAssociatedPlaylistsFn =
({associatedPlaylists}) => {
if (associatedPlaylists.length === 1) {
return associatedPlaylists;
}
return associatedPlaylists.filter((playlist) => playlist.default);
};View on GitHub (pinned to 78fe4bb3fd)
Solutions
- Return only playlist objects that came directly from the `associatedPlaylists` array passed to your callback.
- Select by reference or by matching `src` from the input: `return associatedPlaylists.filter(condition)`.
- If you need a different playlist, filter on properties (e.g., `.default`, `.language`) rather than constructing new objects.
- Do not mutate the `src` field of returned playlist objects.
Example fix
// before
selectM3uAssociatedPlaylists: ({associatedPlaylists}) => {
return [{...associatedPlaylists[0], src: 'https://my-cdn.com/audio.m3u8'}];
}
// after
selectM3uAssociatedPlaylists: ({associatedPlaylists}) => {
return associatedPlaylists.filter(p => p.default);
} Defensive patterns
Strategy: validation
Validate before calling
// Validate that returned playlists are a subset of the input
import type {SelectM3uAssociatedPlaylistsFn} from '@remotion/media-parser';
const safeSelect: SelectM3uAssociatedPlaylistsFn = ({associatedPlaylists}) => {
const validSrcs = new Set(associatedPlaylists.map((p) => p.src));
const selected = myCustomFilter(associatedPlaylists);
// Ensure every returned item has a src from the original list
for (const s of selected) {
if (!validSrcs.has(s.src)) {
throw new Error(`Returned playlist src not in selectable list: ${s.src}`);
}
}
return selected;
}; Try / catch
try {
await parseMedia({src, selectM3uAssociatedPlaylists: myFn});
} catch (e) {
if (e instanceof Error && e.message.includes('cannot be selected because it was not in the list')) {
console.error('Your callback returned a playlist not from the offered list.');
}
throw e;
} Prevention
- Return only playlist objects from the associatedPlaylists array you received.
- Never modify the src field of returned playlists.
- Use .filter() on the input array instead of constructing new objects.
- Do not merge playlists from different manifests in your callback.
When it happens
Trigger: A custom `selectM3uAssociatedPlaylists` callback that constructs and returns a `M3uAssociatedPlaylist` object with a `src` value not present in the `associatedPlaylists` array it received. The guard iterates each returned stream and checks `playlists.find((playlist) => playlist.src === stream.src)`.
Common situations: A callback that returns a modified copy of a playlist with a different `src`. A callback that returns playlists from a different/cached stream manifest. Returning hardcoded playlist objects instead of selecting from the offered list. Merging playlists from multiple manifests.
Related errors
- Expected an array of associated playlists
- No stream with the id ${selectedStreamId} found
- No moov box found in header segment
- Stream does not have a resolution
- Expected m3u-text-value
AI-assisted analysis of remotion-dev/remotion@78fe4bb3fd (2026-08-12).
Data as JSON: /api/errors/41dc5e1f30174d27.
Report an issue: GitHub.