jackwener/OpenCLI · info · EmptyResultError

No notifications found

Error message

No notifications found

What it means

listNotifications paginates through the Jike notifications feed until `limit` rows are collected. When the API stops providing a loadMoreKey cursor and zero notifications were collected, the library throws EmptyResultError rather than returning an empty list, signaling that the account genuinely has no notifications.

Source

Thrown at clis/jike/notifications.js:110

}

async function listNotifications(page, limit) {
    const rows = [];
    const seenIds = new Set();
    const seenCursors = new Set();
    let loadMoreKey = null;
    for (let pageIndex = 0; pageIndex < MAX_PAGES; pageIndex++) {
        const body = await fetchNotificationsPage(page, loadMoreKey);
        for (const notification of body.data) {
            const row = mapNotification(notification);
            if (seenIds.has(notification.id)) continue;
            seenIds.add(notification.id);
            rows.push(row);
            if (rows.length >= limit) return rows;
        }
        const next = body.loadMoreKey;
        if (next == null) {
            if (rows.length === 0) throw new EmptyResultError('jike notifications', 'No notifications found');
            return rows;
        }
        if (typeof next !== 'object' || Array.isArray(next)) {
            throw new CommandExecutionError('Jike notifications API returned a malformed pagination cursor');
        }
        const cursorKey = JSON.stringify(next);
        if (seenCursors.has(cursorKey)) {
            throw new CommandExecutionError('Jike notifications pagination returned a repeated cursor');
        }
        seenCursors.add(cursorKey);
        loadMoreKey = next;
    }
    throw new CommandExecutionError(`Jike notifications pagination exceeded ${MAX_PAGES} pages before satisfying --limit`);
}

cli({
    site: 'jike',
    name: 'notifications',

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Verify the intended account has notifications (check in the Jike app)
  2. Remove or widen filters/limit options that may exclude results
  3. Handle EmptyResultError explicitly if an empty result is acceptable
  4. Check which account/token is configured — ensure it is the expected one

Example fix

// before
cli('jike', 'notifications').run();
// after
try {
  cli('jike', 'notifications').run();
} catch (e) {
  if (e.name === 'EmptyResultError') console.log('(no notifications)');
  else throw e;
}
Defensive patterns

Strategy: try-catch

Try / catch

try {
  await cli('jike', 'notifications').run();
} catch (e) {
  if (e.name === 'EmptyResultError' || String(e.message) === 'No notifications found') {
    return []; // treat as empty, not fatal
  }
  throw e;
}

Prevention

When it happens

Trigger: Calling `jike notifications` for an account with no notifications at all (rows.length === 0 when loadMoreKey is null), typically on the first page with an empty feed.

Common situations: A brand-new or rarely used Jike account; filters or types that exclude all existing notifications; a wrong/secondary account configured so the feed is empty.

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/cffd6a7bca21895f. Report an issue: GitHub.