{"record":{"id":"b7b5a61cf45233c2","repo":"jackwener/OpenCLI","slug":"tiktok-studio-item-list-requires-login-http-res","errorCode":null,"errorMessage":"TikTok Studio item_list requires login (HTTP ${result.status})","messagePattern":"TikTok Studio item_list requires login \\(HTTP (.+?)\\)","errorType":"exception","errorClass":"AuthRequiredError","httpStatus":null,"severity":"error","filePath":"clis/tiktok/creator-videos.js","lineNumber":197,"sourceCode":"        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);\n    const rows = [];\n    let skippedMissingId = 0;\n    const pageSize = limit > SERVER_PAGE_MAX ? SERVER_PAGE_MAX : limit;","sourceCodeStart":179,"sourceCodeEnd":215,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/tiktok/creator-videos.js#L179-L215","documentation":"The item_list endpoint answered with HTTP 401 or 403, meaning the session is not authorized to read Studio data. The library converts this into an AuthRequiredError for www.tiktok.com so callers can trigger a login flow rather than retrying blindly.","triggerScenarios":"result.status is 401 or 403: the current Chrome profile's TikTok session cookie is missing, expired, or lacks Studio permissions for the requested account.","commonSituations":"TikTok session expired (cookies rotated/expired), using a profile that never logged in, logged into a different TikTok account than the Studio target, or TikTok invalidating sessions after suspicious activity.","solutions":["Open TikTok Studio (www.tiktok.com) in the configured Chrome profile and log in / re-authenticate","Verify the logged-in account actually owns or has access to the target creator's Studio data","Clear stale tiktok.com cookies and log in again if re-auth alone doesn't help","Catch AuthRequiredError in your automation and pause for interactive login before retrying"],"exampleFix":"// before\nawait listCreatorVideos(page, { limit: 20 });\n// after\ntry {\n  rows = await listCreatorVideos(page, { limit: 20 });\n} catch (e) {\n  if (e instanceof AuthRequiredError) { await promptUserLogin('www.tiktok.com'); rows = await listCreatorVideos(page, { limit: 20 }); }\n  else throw e;\n}","handlingStrategy":"try-catch","validationCode":"// Pre-check login state\nconst loggedIn = await page.evaluate(() => !!document.querySelector('[data-e2e=\"profile-icon\"], [data-e2e=\"nav-login\"] ~ *'));\nif (!loggedIn) throw new Error('Log in to TikTok Studio first');","typeGuard":"function isAuthError(e) { return e instanceof AuthRequiredError || /requires login/.test(e.message); }","tryCatchPattern":"try {\n  rows = await listCreatorVideos(page, opts);\n} catch (e) {\n  if (e instanceof AuthRequiredError) {\n    await interactiveLogin('www.tiktok.com'); // pause for manual login\n    rows = await listCreatorVideos(page, opts);\n  } else throw e;\n}","preventionTips":["Log in to TikTok Studio in the configured profile before running commands","Re-login when sessions expire; catch AuthRequiredError to trigger this automatically","Confirm the logged-in account has access to the target Studio data"],"tags":["tiktok","auth","http-401","http-403","session-expired"],"backgroundTag":"auth-required-session-expired","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}