jackwener/OpenCLI · error · Error

No videos found for @${username}${suffix}

Error message

No videos found for @${username}${suffix}

What it means

Inside the generated browser pipeline, after deduplicating videos from the universal bootstrap and profile/search API responses, if no rows remain the script throws this error. The suffix '(profile/search API failed: ...)' distinguishes 'network/API calls failed, so we cannot know' from a genuine 'account with zero videos'.

Source

Thrown at clis/tiktok/user.js:163

        if (authorName !== usernameLower) continue;
        addVideo(dedup, item, 'search-fallback');
      }
    } catch (error) {
      searchFailure = error instanceof Error ? error.message : String(error);
      break;
    }
  }

  const rows = Array.from(dedup.values())
    .sort((a, b) => (Number(b.createTime) || 0) - (Number(a.createTime) || 0))
    .slice(0, limit)
    .map((row, index) => ({ ...row, index: index + 1 }));

  if (rows.length === 0) {
    const suffix = primaryFailure || searchFailure
      ? ' (profile/search API failed: ' + (primaryFailure || searchFailure) + ')'
      : '';
    throw new Error('No videos found for @' + username + suffix);
  }
  return rows;
})()
`;
}

async function listUserVideos(page, args) {
    const username = normalizeUsername(args.username);
    const limit = requireLimit(args.limit, { fallback: DEFAULT_LIMIT, max: MAX_LIMIT });
    await page.goto(`https://www.tiktok.com/@${encodeURIComponent(username)}`, { waitUntil: 'load', settleMs: 6000 });
    let rows;
    try {
        rows = await page.evaluate(buildUserScript(username, limit));
    } catch (error) {
        throwTikTokPageContextError(error, {
            authMessage: 'TikTok requires browser access to load user videos',
            emptyPattern: /No videos found/,
            emptyTarget: 'tiktok user',

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Read the suffix: if it names a profile/search API failure, fix the underlying API issue (msToken, cookies, rate limits) and retry.
  2. Confirm in a browser whether the account really has zero videos.
  3. Add delays/backoff between requests to avoid throttling that empties the feed.
  4. If scraping an account you expect to have videos, check for region restrictions or a private account.

Example fix

// before: surfaces a bare empty error on transient API failure
const videos = await cli.tiktok.user('someuser');
// after: inspect the message and retry on API-failure suffix
try {
  const videos = await cli.tiktok.user('someuser');
} catch (e) {
  if (/profile\/search API failed/.test(e.message)) await retryWithBackoff(() => cli.tiktok.user('someuser'));
  else throw e;
}
Defensive patterns

Strategy: retry

Validate before calling

// detect genuine emptiness vs transient API failure by checking the account first
const page = await fetch(`https://www.tiktok.com/@${handle}`);
const html = await page.text();
const hasItems = /"itemList"\s*:\s*\[\s*\{/.test(html);
if (!hasItems) console.warn(`@${handle} may genuinely have no public videos`);

Try / catch

try {
  rows = await cli.tiktok.user(handle);
} catch (e) {
  if (/No videos found/.test(e.message) && /API failed/.test(e.message)) {
    rows = await retryWithBackoff(() => cli.tiktok.user(handle), { attempts: 3 });
  } else throw e;
}

Prevention

When it happens

Trigger: secUid resolved but the profile feed returned no items; the primary profile API and fallback search API both failed (suffix shows the failure reason); the account genuinely has zero public videos; the feed was truncated to page 0 by rate limiting.

Common situations: New or empty TikTok accounts; TikTok throttling anonymous requests so both API sources fail; region-blocked content yielding empty feeds; transient API outages during batch scraping.

Understand the failure class

Background: EmptyResultError / "no results found": when an API or scraper succeeds but returns zero rows — this error's family across 9 libraries.

Related errors


AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29). Data as JSON: /api/errors/5c365ec5ecf35cf3. Report an issue: GitHub.