jely2002/youtube-dl-gui · warning · Error
No playlist entries match the selected range.
Error message
No playlist entries match the selected range.
What it means
After resolving the playlist's entries, expandPlaylistGroup applies the user's selection (range) via applyPlaylistSelectionToEntries. If no entries survive the filter it throws 'No playlist entries match the selected range.' This guards against building an empty download spec.
Solutions
- Clamp the selection range to entries.length before calling expandPlaylistGroup.
- Validate in the UI that at least one entry is selected before submitting (disable the confirm button).
- Reset persisted selection state when a new/different playlist is loaded.
- Catch this error and show a user-facing message like 'Your selected range matches no entries'.
Example fix
// before
await expandPlaylistGroup(groupId, selection);
// after
const clamped = {
...selection,
end: Math.min(selection.end, entries.length - 1),
};
if (clamped.start > clamped.end) return;
await expandPlaylistGroup(groupId, clamped); Defensive patterns
Strategy: validation
Validate before calling
const entries = groupStore.findGroupById(groupId)?.entries ?? [];
const selected = applyPlaylistSelectionToEntries(entries, selection);
if (selected.length === 0) {
throw new RangeError('Selection matches no playlist entries');
} Type guard
const hasSelection = (n: number): boolean => Number.isFinite(n) && n > 0;
Try / catch
try {
await expandPlaylistGroup(groupId, selection);
} catch (e) {
if (e instanceof Error && e.message.includes('No playlist entries match')) {
toast.error('Your selected range matches no entries.');
return;
}
throw e;
} Prevention
- Clamp selection start/end to [0, entries.length - 1] before submitting.
- Disable the confirm button until at least one entry is selected.
- Reset saved selection state when loading a different playlist.
When it happens
Trigger: A PlaylistSelection whose start/end indices (or chosen entries) select zero entries — e.g. selection start beyond the playlist length, an inverted range, or selecting only entries that were filtered out.
Common situations: UI state remembered from a previous (longer) playlist applied to a shorter one; off-by-one index bounds in a range picker; user submits the dialog without picking any entries.
Understand the failure class
Background: EmptyResultError / "no results found": when an API or scraper succeeds but returns zero rows — this error's family across 9 libraries.
Related errors
AI-assisted analysis of jely2002/youtube-dl-gui@c402ee39c0 (2026-09-12).
Data as JSON: /api/errors/a99788d0e4a960cd.
Report an issue: GitHub.
Appendix: source
Thrown at src/stores/media/media.ts:161
}
const next = total > 1 && isFirst
? MediaState.fetchingList
: MediaState.configure;
stateStore.setState(item.id, next);
}
async function expandPlaylistGroup(groupId: string, selection: PlaylistSelection) {
const group = groupStore.findGroupById(groupId);
const leader = groupStore.findGroupLeader(groupId);
const entries = group?.entries;
if (!group || !leader?.entries || !entries) {
throw new Error(`Playlist group ${groupId} is missing entry metadata.`);
}
const selectedEntries = applyPlaylistSelectionToEntries(entries, selection);
if (selectedEntries.length === 0) {
throw new Error('No playlist entries match the selected range.');
}
const spec = buildPlaylistItemsSpec(selection);
const previousOverrides = optionsStore.getOverrides(groupId);
const nextOverrides = cloneDownloadOverrides(previousOverrides) ?? {};
if (spec) {
nextOverrides.inputFilters = {
...(nextOverrides.inputFilters ?? {}),
playlistItems: spec,
};
} else if (nextOverrides.inputFilters) {
delete nextOverrides.inputFilters.playlistItems;
if (Object.keys(nextOverrides.inputFilters).length === 0) {
delete nextOverrides.inputFilters;
}
}
if (Object.keys(nextOverrides).length > 0) {View on GitHub (pinned to c402ee39c0)