remotion-dev/remotion · error · Error
No stream with the id ${selectedStreamId} found
Error message
No stream with the id ${selectedStreamId} found What it means
Thrown by `selectStream` when the custom `selectM3uStream` callback returns an `id` that does not match any `M3uStream` in the `streams` array. The callback must return a numeric `id` corresponding to one of the offered streams.
Source
Thrown at packages/media-parser/src/containers/m3u/select-stream.ts:81
export const selectStream = async ({
streams,
fn,
}: {
streams: M3uStream[];
fn: SelectM3uStreamFn;
}): Promise<M3uStream> => {
if (streams.length < 1) {
throw new Error('No streams found');
}
const selectedStreamId = await fn({streams});
const selectedStream = streams.find(
(stream) => stream.id === selectedStreamId,
);
if (!selectedStream) {
throw new Error(`No stream with the id ${selectedStreamId} found`);
}
return Promise.resolve(selectedStream);
};
export const defaultSelectM3uStreamFn: SelectM3uStreamFn = ({streams}) => {
return Promise.resolve(streams[0].id);
};
View on GitHub (pinned to 78fe4bb3fd)
Solutions
- Return the `id` property of a stream that exists in the `streams` array passed to your callback.
- Select by finding the desired stream first: `return streams.find(s => s.bandwidth > 1000000).id`.
- Use the default `defaultSelectM3uStreamFn` which returns `streams[0].id` if you just want the first stream.
- Log `streams.map(s => s.id)` in your callback to verify valid IDs before returning one.
Example fix
// before
selectM3uStream: ({streams}) => {
return 0; // might not be a valid id
}
// after
selectM3uStream: ({streams}) => {
return streams[0].id;
} Defensive patterns
Strategy: validation
Validate before calling
// Validate the returned id before it is used
import type {SelectM3uStreamFn} from '@remotion/media-parser';
const safeSelect: SelectM3uStreamFn = ({streams}) => {
const id = myCustomSelect(streams);
if (!streams.some((s) => s.id === id)) {
throw new Error(`Invalid stream id ${id}. Valid: ${streams.map((s) => s.id).join(', ')}`);
}
return id;
}; Try / catch
try {
await parseMedia({src, selectM3uStream: myFn});
} catch (e) {
if (e instanceof Error && e.message.includes('No stream with the id')) {
console.error('Your selectM3uStream callback returned an invalid id.');
}
throw e;
} Prevention
- Always return the .id property of a stream from the streams array you received.
- Do not return a hardcoded index; stream ids may not start at 0.
- Use streams.find(condition).id rather than guessing ids.
- Use the default callback (streams[0].id) if you just want the first stream.
When it happens
Trigger: Providing a custom `selectM3uStream` option to `parseMedia()` that returns an `id` not present among the `streams[i].id` values. The lookup `streams.find((stream) => stream.id === selectedStreamId)` returns `undefined`.
Common situations: A callback that returns a hardcoded `id` (e.g., `return 0`) when stream IDs don't start at 0. Returning an index instead of an `id`. Returning `id` from a stale or different manifest. Off-by-one errors between stream index and stream id.
Related errors
- Expected an array of associated playlists
- The associated playlist ${JSON.stringify(streams)} cannot be
- 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/ad5d1dbe6e1e338d.
Report an issue: GitHub.