{"record":{"id":"2b280381792a14dc","repo":"jackwener/OpenCLI","slug":"tiktok-returned-an-empty-recommend-feed","errorCode":null,"errorMessage":"TikTok returned an empty recommend feed","messagePattern":"TikTok returned an empty recommend feed","errorType":"exception","errorClass":"EmptyResultError","httpStatus":null,"severity":"warning","filePath":"clis/tiktok/explore.js","lineNumber":142,"sourceCode":"`;\n}\n\nasync function listExploreVideos(page, args) {\n    const limit = requireLimit(args.limit, { fallback: DEFAULT_LIMIT, max: MAX_LIMIT });\n    await page.goto('https://www.tiktok.com/explore', { waitUntil: 'load', settleMs: 5000 });\n    let rows;\n    try {\n        rows = await page.evaluate(buildExploreScript(limit));\n    } catch (error) {\n        throwTikTokPageContextError(error, {\n            authMessage: 'TikTok requires browser access to load the explore feed',\n            emptyPattern: /No videos found/,\n            emptyTarget: 'tiktok explore',\n            failureMessage: 'Failed to load TikTok explore feed',\n        });\n    }\n    if (!Array.isArray(rows) || rows.length === 0) {\n        throw new EmptyResultError('tiktok explore', 'TikTok returned an empty recommend feed');\n    }\n    return rows;\n}\n\nexport const exploreCommand = cli({\n    site: 'tiktok',\n    name: 'explore',\n    access: 'read',\n    description: 'Get trending TikTok videos from the recommend feed via page-context APIs',\n    domain: 'www.tiktok.com',\n    strategy: Strategy.COOKIE,\n    browser: true,\n    args: [\n        { name: 'limit', type: 'int', default: DEFAULT_LIMIT, help: `Number of videos to return (max ${MAX_LIMIT})` },\n    ],\n    columns: ['index', 'id', 'author', 'url', 'cover', 'title', 'desc', 'plays', 'likes', 'comments', 'shares', 'createTime'],\n    func: listExploreVideos,\n});","sourceCodeStart":124,"sourceCodeEnd":160,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/tiktok/explore.js#L124-L160","documentation":"After the explore script (with its built-in empty-result detection and retry wrapper) completed, the resolved value was either not an array or an empty array. listExploreVideos throws an EmptyResultError stating the recommend feed came back empty.","triggerScenarios":"The explore/recommend extraction resolved to null/undefined/non-array, or to an array of length 0 even after the script's internal retry with emptyPattern /No videos found/ matching.","commonSituations":"TikTok's recommend feed is A/B-varied or region-locked to empty for the current IP, a login-gated feed, or the extraction script silently returning [] after TikTok changed feed markup.","solutions":["Confirm /explore shows videos when visited manually in the same profile","Retry once after a pause — the recommend feed is sometimes transiently empty","Check region/IP; switch to a region where the recommend feed is populated","Update the library if TikTok changed the feed DOM/API structure","Treat EmptyResultError as 'no feed data' in your pipeline, not a crash"],"exampleFix":"// before\nconst rows = await listExploreVideos(page, { limit: 20 });\n// after\nlet rows;\ntry { rows = await listExploreVideos(page, { limit: 20 }); }\ncatch (e) {\n  if (e instanceof EmptyResultError) { await sleep(3000); rows = await listExploreVideos(page, { limit: 20 }); }\n  else throw e;\n}","handlingStrategy":"retry","validationCode":null,"typeGuard":"function isNonEmptyArray(v) { return Array.isArray(v) && v.length > 0; }","tryCatchPattern":"try {\n  rows = await listExploreVideos(page, opts);\n} catch (e) {\n  if (e instanceof EmptyResultError) {\n    await sleep(3000);\n    return listExploreVideos(page, opts); // recommend feed is sometimes transiently empty\n  }\n  throw e;\n}","preventionTips":["Retry once or twice — the recommend feed can be transiently empty","Verify the profile/IP can see the feed manually (login wall, region block)","Treat EmptyResultError as no-data rather than a hard failure","Update the library when TikTok changes feed markup"],"tags":["tiktok","empty-result","recommend-feed","scraping"],"backgroundTag":"empty-result-set","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}