jackwener/OpenCLI · error · CommandExecutionError
String(data.error)
Error message
String(data.error)
What it means
CommandExecutionError wrapping the raw error string returned inside the scrape result object (data.error). The playlist extraction succeeded structurally but reported a domain-specific failure — e.g. YouTube showed an error/alert box instead of playlist data — and the library surfaces that string verbatim.
Source
Thrown at clis/youtube/playlist.js:89
while (videos.length < limit && contItem?.continuationItemRenderer) {
const token = contItem.continuationItemRenderer?.continuationEndpoint?.continuationCommand?.token;
if (!token) break;
const contData = await fetchBrowse(apiKey, { context, continuation: token });
if (contData.error) break;
const newItems = contData.onResponseReceivedActions?.[0]?.appendContinuationItemsAction?.continuationItems || [];
if (!newItems.length) break;
videos = videos.concat(extractVideos(newItems));
contItem = newItems[newItems.length - 1];
}
return { title, channelName, stats, videos: videos.slice(0, limit) };
})()
`);
if (!data || typeof data !== 'object') {
throw new CommandExecutionError('Failed to fetch playlist data');
}
if (data.error) {
throw new CommandExecutionError(String(data.error));
}
if (!data.videos?.length) {
throw new EmptyResultError('youtube playlist');
}
const statsStr = (data.stats || []).join(' | ');
process.stderr.write(`${data.title} [${data.channelName}] ${statsStr}\n`);
return data.videos;
},
});
View on GitHub (pinned to 49907e53dc)
Solutions
- Check the error string — 'playlist unavailable' means the ID is wrong/private/deleted
- Verify the playlist opens in a normal browser
- Login to YouTube in the CLI profile if consent/age gating is indicated
- Update the CLI package to pick up extraction fixes for new YouTube markup
Example fix
// before opencli youtube playlist PL_DELETED // 'The playlist does not exist.' // after opencli youtube playlist PL_EXISTING_PUBLIC_ID
Defensive patterns
Strategy: try-catch
Validate before calling
null
Type guard
null
Try / catch
try {
const videos = await run('youtube playlist', [id]);
} catch (e) {
if (/does not exist|unavailable|private/i.test(e.message)) {
console.error(`Playlist ${id} is gone or private: ${e.message}`);
} else throw e;
} Prevention
- Handle the surfaced error string as domain truth (deleted/private/unavailable)
- Check playlist existence periodically in automations over long-lived IDs
- Re-login if consent/age gating is indicated in the message
- Update the CLI package when extraction breaks after YouTube updates
When it happens
Trigger: The in-page script returns {error: '<description>'} — typically ytInitialData missing, a 'Playlist does not exist' / 'unavailable' alert, or a consent/bot-check page detected during extraction.
Common situations: Deleted or private playlist IDs, region-locked playlists, YouTube UI/ytInitialData schema changes breaking extraction, or age/consent interstitials in headless sessions.
Related errors
- Failed to fetch playlist data
- String(data.error)
- errMsg
- Failed to fetch YouTube feed
- Failed to fetch YouTube history
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/bd69dbe2ffca4643.
Report an issue: GitHub.