{"record":{"id":"820b46531a6f22be","repo":"jackwener/OpenCLI","slug":"youtube-playlist","errorCode":null,"errorMessage":"youtube playlist","messagePattern":"youtube playlist","errorType":"exception","errorClass":"EmptyResultError","httpStatus":null,"severity":"warning","filePath":"clis/youtube/playlist.js","lineNumber":92,"sourceCode":"          const contData = await fetchBrowse(apiKey, { context, continuation: token });\n          if (contData.error) break;\n          const newItems = contData.onResponseReceivedActions?.[0]?.appendContinuationItemsAction?.continuationItems || [];\n          if (!newItems.length) break;\n          videos = videos.concat(extractVideos(newItems));\n          contItem = newItems[newItems.length - 1];\n        }\n\n        return { title, channelName, stats, videos: videos.slice(0, limit) };\n      })()\n    `);\n        if (!data || typeof data !== 'object') {\n            throw new CommandExecutionError('Failed to fetch playlist data');\n        }\n        if (data.error) {\n            throw new CommandExecutionError(String(data.error));\n        }\n        if (!data.videos?.length) {\n            throw new EmptyResultError('youtube playlist');\n        }\n        const statsStr = (data.stats || []).join(' | ');\n        process.stderr.write(`${data.title}  [${data.channelName}]  ${statsStr}\\n`);\n        return data.videos;\n    },\n});\n","sourceCodeStart":74,"sourceCodeEnd":99,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/youtube/playlist.js#L74-L99","documentation":"EmptyResultError thrown when playlist data was fetched successfully but the extracted videos array is empty (data.videos is missing or zero-length). It signals a well-formed playlist page with no parseable video entries rather than a hard failure.","triggerScenarios":"A playlist that exists but contains zero videos, or a page where video extraction selectors matched nothing (YouTube markup change, unexpanded continuation content, or a saved/hidden playlist variant).","commonSituations":"Freshly created empty playlist, playlist whose videos are all deleted/private, or YouTube DOM changes so the scraper finds the playlist header but no video rows.","solutions":["Confirm the playlist actually shows videos in a browser","Re-run with a larger --limit or default settings in case a small-limit filter emptied the result","Update the CLI if extraction selectors no longer match YouTube's DOM"],"exampleFix":"// before\nopencli youtube playlist PL_EMPTY  // 0 videos\n// after\nopencli youtube playlist PL_WITH_VIDEOS --limit 20","handlingStrategy":"type-guard","validationCode":"null","typeGuard":"function hasVideos(result) {\n  return Array.isArray(result) && result.length > 0;\n}\n// caller:\nconst videos = await run('youtube playlist', [id]).catch(() => []);\nif (!hasVideos(videos)) console.warn(`Playlist ${id} yielded no videos`);","tryCatchPattern":"try {\n  const videos = await run('youtube playlist', [id]);\n  if (!videos.length) console.warn('Playlist is empty or unparseable');\n} catch (e) {\n  if (/Empty result/i.test(e.message)) console.warn(`No videos in playlist ${id}`);\n  else throw e;\n}","preventionTips":["Treat zero-video playlists as a valid state, not always a bug","Verify the playlist has public videos in a browser","Re-run with default limit if extraction is suspected","Update the CLI if YouTube markup changes"],"tags":["youtube","playlist","empty-result","scraping"],"backgroundTag":"empty-result-set","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}