jackwener/OpenCLI · warning · EmptyResultError

linkedin inbox

Error message

linkedin inbox

What it means

After parsing and optionally filtering to unread conversations, if the inbox contains zero conversations the CLI throws an EmptyResultError keyed on the command name 'linkedin inbox'. The library treats an empty result as a distinct, catchable condition rather than returning []. Note: when --unread-only is set and nothing is unread, it returns [] instead of throwing.

Source

Thrown at clis/linkedin/inbox.js:210

    // Widen the page size to the requested limit where the query supports it.
    const targetUrl = located.url.replace(/count:\d+/, 'count:' + limit);
    const fetched = unwrapEvaluateResult(
      await page.evaluate(`(${fetchMessagingApi.toString()})(${JSON.stringify(targetUrl)}, ${JSON.stringify(csrf)})`),
    );
    if (fetched && fetched.authRequired) {
      throw new AuthRequiredError(LINKEDIN_DOMAIN, 'LinkedIn messaging API authentication failed: ' + fetched.error);
    }
    if (!fetched || fetched.error || !fetched.json) {
      throw new CommandExecutionError(
        'LinkedIn messaging API returned an unexpected response: ' + ((fetched && fetched.error) || 'no data'),
      );
    }

    let conversations = parseConversations(fetched.json, located.mailboxUrn || '');
    if (unreadOnly) conversations = conversations.filter((c) => c.unread);
    if (conversations.length === 0) {
      if (unreadOnly) return [];
      throw new EmptyResultError('linkedin inbox', 'No LinkedIn conversations were found in the inbox.');
    }

    return conversations.slice(0, limit).map((c, index) => ({
      rank: index + 1,
      thread_url: threadUrl(c.thread_id),
      thread_id: c.thread_id,
      person_name: c.person_name,
      last_message_preview: c.last_message_preview,
      unread: c.unread,
      counterparty_type: c.counterparty_type,
      category: c.category,
      timestamp: c.timestamp,
    }));
  },
});

export const __test__ = {
  parseConversations,

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Confirm the inbox actually has conversations by checking linkedin.com/messaging in the browser.
  2. Drop --unread-only if you expected unread items but none exist (that path returns [] without error).
  3. If conversations exist on the site but the error persists, the parser may no longer match LinkedIn's payload — update/report the library.
  4. Catch EmptyResultError explicitly and treat it as an empty inbox in your automation.

Example fix

// before
const convos = inbox(); // throws EmptyResultError on empty inbox

// after
let convos;
try { convos = inbox(); }
catch (e) {
  if (e instanceof EmptyResultError) convos = [];
  else throw e;
}
Defensive patterns

Strategy: try-catch

Type guard

const isEmptyResultError = (e) => e instanceof EmptyResultError && e.command === 'linkedin inbox';

Try / catch

let conversations;
try {
  conversations = await linkedinInbox(opts);
} catch (e) {
  if (e instanceof EmptyResultError) conversations = [];
  else throw e;
}

Prevention

When it happens

Trigger: Calling `linkedin inbox` (without --unread-only) when parseConversations() yields no conversations from the fetched JSON — a genuinely empty inbox, or a parse that matched nothing due to a payload shape change.

Common situations: Brand-new LinkedIn account with no messages, all conversations archived/deleted, messages filtered to a folder the API query doesn't cover, or a LinkedIn API change making the parser silently return [] .

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