jackwener/OpenCLI · error · Error
No friend suggestions returned by TikTok + suffix
Error message
No friend suggestions returned by TikTok + suffix
What it means
The friends command pages TikTok's recommend-user API for friend suggestions; if no unique suggestion rows are collected, it throws 'No friend suggestions returned by TikTok'. When a page fetch failed, the API error is appended as '(recommend-user API failed: ...)' so callers can see why suggestions were empty.
Source
Thrown at clis/tiktok/friends.js:100
const row = normalizeUserRow(entry?.user || entry, dedup.size + 1);
if (row && !dedup.has(row.username)) dedup.set(row.username, row);
}
if (data.hasMore !== true) break;
cursor = asNumber(data.cursor) ?? cursor + list.length;
} catch (error) {
apiFailure = error instanceof Error ? error.message : String(error);
break;
}
}
}
const rows = Array.from(dedup.values())
.slice(0, limit)
.map((row, index) => ({ ...row, index: index + 1 }));
if (rows.length === 0) {
const suffix = apiFailure ? ' (recommend-user API failed: ' + apiFailure + ')' : '';
throw new Error('No friend suggestions returned by TikTok' + suffix);
}
return rows;
})()
`;
}
async function listFriends(page, args) {
const limit = requireLimit(args.limit, { fallback: DEFAULT_LIMIT, max: MAX_LIMIT });
await page.goto('https://www.tiktok.com/friends', { waitUntil: 'load', settleMs: 5000 });
let rows;
try {
rows = await page.evaluate(buildFriendsScript(limit));
} catch (error) {
throwTikTokPageContextError(error, {
authMessage: 'TikTok requires browser access to load friend suggestions',
emptyPattern: /No friend suggestions/,
emptyTarget: 'tiktok friends',
failureMessage: 'Failed to load TikTok friend suggestions',View on GitHub (pinned to 49907e53dc)
Solutions
- Inspect the '(recommend-user API failed: ...)' suffix for the root API error and fix that first.
- Refresh cookies/msToken by logging in normally and retrying.
- Retry after a delay — recommendation endpoints are rate-limited and often recover.
- Confirm in a browser that tiktok.com shows friend suggestions for this account.
- If the account has no suggestions, catch this error and treat it as an empty list.
Defensive patterns
Strategy: try-catch
Type guard
function isFriendsEmpty(e) {
return e instanceof Error && e.message.startsWith('No friend suggestions returned by TikTok');
}
function hadApiFailure(e) { return /recommend-user API failed:/.test(e?.message || ''); } Try / catch
try {
rows = await friendsCommand({ limit });
} catch (e) {
if (isFriendsEmpty(e)) {
if (hadApiFailure(e)) await sleep(60_000); // retry after API failure
else rows = []; // no suggestions for this account
} else throw e;
} Prevention
- Read the recommend-user failure suffix before retrying
- Refresh cookies/msToken when the suffix shows API errors
- Retry after delay — recommendations are rate-limited and time-varying
- Handle genuinely suggestion-less accounts as empty, not fatal
When it happens
Trigger: The recommend-user endpoint returned an empty list (no suggestions generated for the account); the first API call failed (assertTikTokApiSuccess threw) setting apiFailure; msToken/signature issues causing rejected requests.
Common situations: Fresh or low-activity accounts with no friend suggestions; TikTok rate-limiting the recommend endpoint from automation; logged-out or semi-logged-in state producing empty recommendation payloads.
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
- No following entries returned + suffix
- No live streams returned${suffix}
- No notifications returned for ${noticeLabel}${suffix}
- No videos found for @${username}
- No videos found for @${username}${suffix}
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/bb5454644f6f41c0.
Report an issue: GitHub.