{"record":{"id":"ab1f8f439ff63875","repo":"jackwener/OpenCLI","slug":"tiktok-studio-item-list-network-failure-result","errorCode":null,"errorMessage":"TikTok Studio item_list network failure: ${result.networkError}","messagePattern":"TikTok Studio item_list network failure: (.+?)","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/tiktok/creator-videos.js","lineNumber":194,"sourceCode":"        date: formatDate(item.post_time ?? item.create_time ?? item.schedule_time),\n        views: normalizeNumber(item.play_count),\n        likes: normalizeNumber(item.like_count),\n        comments: normalizeNumber(item.comment_count),\n        saves: normalizeNumber(item.favorite_count),\n        shares: normalizeNumber(item.share_count),\n        url,\n    };\n}\n\nasync function fetchCreatorVideosPage(page, cursor, size) {\n    const result = await page.evaluate(buildFetchItemListScript(buildItemListRequest(cursor, size))).catch((error) => {\n        throw new CommandExecutionError(`Failed to fetch TikTok Studio item_list: ${getErrorMessage(error)}`);\n    });\n    if (!result || typeof result !== 'object') {\n        throw new CommandExecutionError('TikTok Studio item_list returned an unreadable response');\n    }\n    if (result.networkError) {\n        throw new CommandExecutionError(`TikTok Studio item_list network failure: ${result.networkError}`);\n    }\n    if (result.status === 401 || result.status === 403) {\n        throw new AuthRequiredError('www.tiktok.com', `TikTok Studio item_list requires login (HTTP ${result.status})`);\n    }\n    if (!result.ok) {\n        const detail = result.parseError\n            ? `invalid JSON (${result.parseError})`\n            : `HTTP ${result.status || 0}${result.statusText ? ` ${result.statusText}` : ''}`;\n        throw new CommandExecutionError(`TikTok Studio item_list failed: ${detail}`, result.text ? `Response preview: ${result.text}` : undefined);\n    }\n    const payload = unwrapPayload(result.data);\n    assertApiSuccess(payload);\n    return payload;\n}\n\nasync function listCreatorVideos(page, args) {\n    const limit = requirePositiveInt(args.limit, 'limit', DEFAULT_LIMIT, MAX_LIMIT);\n    let nextCursor = requireCursor(args.cursor);","sourceCodeStart":176,"sourceCodeEnd":212,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/tiktok/creator-videos.js#L176-L212","documentation":"The in-page fetch itself completed but the network layer reported a failure (result.networkError is set, e.g. fetch threw TypeError: Failed to fetch, DNS failure, or request blocked). The library surfaces the browser-side network error message verbatim as a CommandExecutionError.","triggerScenarios":"result.networkError truthy: the item_list XHR/fetch failed at the network level — connection reset, CORS/blocked request, TLS error, offline machine, or TikTok's edge dropping the request.","commonSituations":"Corporate proxy or firewall blocking tiktok API endpoints, VPN/IP flagged by TikTok, IPv6 issues, or running while the machine's network dropped.","solutions":["Use the networkError text to identify the exact network-layer cause (DNS, blocked, reset)","Check general connectivity to www.tiktok.com in the same Chrome profile","Disable conflicting proxies/VPN or configure the browser's proxy correctly","Retry after a delay; if your IP is rate-limited/flagged, switch network or wait","Catch CommandExecutionError and implement backoff retry for transient failures"],"exampleFix":"// before\nif (result.networkError) throw new CommandExecutionError(`... ${result.networkError}`);\n// after (caller)\ntry {\n  rows = await listCreatorVideos(page, opts);\n} catch (e) {\n  if (/network/i.test(e.message)) { await sleep(5000); rows = await listCreatorVideos(page, opts); }\n  else throw e;\n}","handlingStrategy":"retry","validationCode":"await fetch('https://www.tiktok.com', { method: 'HEAD' }).catch(() => { throw new Error('No connectivity to tiktok.com'); });","typeGuard":"function hasNetworkError(r) { return !!r && typeof r === 'object' && typeof r.networkError === 'string'; }","tryCatchPattern":"try {\n  rows = await listCreatorVideos(page, opts);\n} catch (e) {\n  if (/network failure/.test(e.message)) {\n    await sleep(5000); rows = await listCreatorVideos(page, opts);\n  } else throw e;\n}","preventionTips":["Check machine connectivity/proxy/VPN before long scraping runs","Avoid IPs known to be blocked by TikTok; rotate if needed","Add backoff retries for network-layer failures","Verify www.tiktok.com loads normally in the profile before automation"],"tags":["tiktok","network","fetch-failed","connectivity"],"backgroundTag":"failed-to-fetch","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}