{"record":{"id":"25bb8b4efdbbc4de","repo":"jackwener/OpenCLI","slug":"no-videos-found-for-username","errorCode":null,"errorMessage":"No videos found for @${username}","messagePattern":"No videos found for @(.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"clis/tiktok/user.js","lineNumber":95,"sourceCode":"  }\n\n  const universal = findUniversalData();\n  let secUid = '';\n  const profileUser = findProfileUser(universal);\n  if (profileUser) {\n    secUid = String(profileUser.secUid || profileUser.sec_uid || '').trim();\n  }\n\n  const msToken = getCookie('msToken');\n  if (!secUid) {\n    const params = new URLSearchParams({ uniqueId: username, aid });\n    if (msToken) params.set('msToken', msToken);\n    const detail = await fetchJson('/api/user/detail/?' + params.toString());\n    assertTikTokApiSuccess(detail, 'user-detail');\n    secUid = String(detail?.userInfo?.user?.secUid || detail?.user?.secUid || '').trim();\n  }\n  if (!secUid) {\n    throw new Error('No videos found for @' + username);\n  }\n\n  const dedup = new Map();\n  for (const item of collectProfileItems(universal, secUid)) {\n    addVideo(dedup, item, 'bootstrap');\n  }\n\n  let cursor = 0;\n  let primaryFailure = null;\n  for (let page = 0; page < maxPages && dedup.size < limit; page += 1) {\n    const params = new URLSearchParams({\n      secUid,\n      count: String(pageSize),\n      cursor: String(cursor),\n      aid,\n    });\n    if (msToken) params.set('msToken', msToken);\n    try {","sourceCodeStart":77,"sourceCodeEnd":113,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/tiktok/user.js#L77-L113","documentation":"listUserVideos resolves the target account's secUid via the universal page bootstrap and, when needed, the /api/user/detail/ endpoint. If every source leaves secUid empty, the library cannot address the user's profile feed and throws this error. It means 'this username does not resolve to a TikTok account', not merely 'the account has no videos'.","triggerScenarios":"Passing a username that does not exist or was renamed; the user-detail API returning an error or an HTML login page instead of JSON (assertTikTokApiSuccess passing but userInfo.user.secUid absent); msToken missing/expired so the detail call is rejected; a typo'd or URL-encoded handle passed to the command.","commonSituations":"Scraping a deleted/banned/private account; TikTok API schema change moving secUid to a new field; rate limiting returning degraded responses without a hard failure; passing a full profile URL instead of the bare handle.","solutions":["Verify the username exists by opening https://www.tiktok.com/@<username> in a browser; fix typos and pass the bare handle.","Supply or refresh msToken (and cookies) so the /api/user/detail/ call succeeds.","Check whether the API response shape changed and update the secUid extraction fields.","Retry later if the profile API is rate-limited or temporarily failing."],"exampleFix":"// before\nawait cli.tiktok.user('todoqst'); // typo -> secUid never resolves\n// after: verify the handle first, then call\nconst handle = 'todoqs1'.replace(/^@+/, '');\nif (!/^[A-Za-z0-9._-]+$/.test(handle)) throw new Error('bad handle');\nawait cli.tiktok.user(handle);","handlingStrategy":"validation","validationCode":"// pre-check the handle resolves before calling the CLI\nconst handle = username.replace(/^@+/, '').trim();\nif (!/^[A-Za-z0-9._-]+$/.test(handle)) throw new Error('invalid TikTok handle');\nconst probe = await fetch(`https://www.tiktok.com/@${handle}`, { redirect: 'manual' });\nif (probe.status >= 300 && probe.status < 400) throw new Error(`@${handle} does not exist`);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Verify usernames exist in a browser before batch runs","Keep msToken/cookies configured so the user-detail API can resolve secUid","Pass bare handles, not URLs or display names","Watch for TikTok API schema changes that relocate secUid"],"tags":["tiktok","api","empty-result","authentication"],"backgroundTag":"empty-result-set","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}