jackwener/OpenCLI · error · Error
No notifications returned for ${noticeLabel}${suffix}
Error message
No notifications returned for ${noticeLabel}${suffix} What it means
The notifications command reads TikTok's notice API (all/activity-type notifications, selected via noticeLabel) and throws 'No notifications returned for <label>' when zero unique rows are collected. If a page fetch failed, the API error is appended as '(notice API failed: ...)' so callers can distinguish an API failure from an actually empty inbox.
Source
Thrown at clis/tiktok/notifications.js:100
for (const entry of list) {
const row = normalizeNotification(entry, dedup.size + 1);
if (row && !dedup.has(row.id)) dedup.set(row.id, row);
}
if (data.has_more !== true && data.hasMore !== true) break;
maxTime = asNumber(data.min_time) ?? asNumber(data.maxTime) ?? maxTime + 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 ? ' (notice API failed: ' + apiFailure + ')' : '';
throw new Error('No notifications returned for ' + noticeLabel + suffix);
}
return rows;
})()
`;
}
async function listNotifications(page, args) {
const limit = requireLimit(args.limit, { fallback: DEFAULT_LIMIT, max: MAX_LIMIT });
const typeKey = requireNotificationType(args.type);
await page.goto('https://www.tiktok.com/foryou', { waitUntil: 'load', settleMs: 5000 });
let rows;
try {
rows = await page.evaluate(buildNotificationsScript(limit, typeKey));
} catch (error) {
throwTikTokPageContextError(error, {
authMessage: 'TikTok requires login to read notifications',
emptyPattern: /No notifications returned/,
emptyTarget: 'tiktok notifications',View on GitHub (pinned to 49907e53dc)
Solutions
- Check the '(notice API failed: ...)' suffix for the root API error and fix that first.
- Re-login / refresh session cookies and msToken, then retry.
- Wait and retry if rate-limited — the notice endpoint throttles automated polling.
- Confirm in a browser that the notification tab shows entries for this label.
- If the inbox is genuinely empty for that label, catch this error and treat it as an empty list.
Defensive patterns
Strategy: try-catch
Type guard
function isNotificationsEmpty(e) {
return e instanceof Error && e.message.startsWith('No notifications returned for');
}
function hadApiFailure(e) { return /notice API failed:/.test(e?.message || ''); } Try / catch
try {
rows = await notificationsCommand({ limit });
} catch (e) {
if (isNotificationsEmpty(e)) {
if (hadApiFailure(e)) await sleep(60_000); // retry after API failure
else rows = []; // inbox empty for this label
} else throw e;
} Prevention
- Parse the notice-API failure suffix to separate API errors from empty inboxes
- Refresh session cookies/msToken before long polling loops
- Back off between notification polls to avoid notice-endpoint throttling
- Confirm in the browser which notification labels actually have entries
When it happens
Trigger: The notice endpoint returned an empty notification list for the selected label (e.g. no 'activities' notifications); the first page call failed via assertTikTokApiSuccess/fetchJson, setting apiFailure; missing msToken or an expired session causing rejected requests.
Common situations: Quiet account with genuinely no notifications of that type; TikTok rate-limiting the notice endpoint; login cookies expired so the API returns an auth/empty payload; region or account settings filtering out notification types.
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 friend suggestions returned by TikTok + suffix
- No live streams returned${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/37b2a3080424323a.
Report an issue: GitHub.