jackwener/OpenCLI · error · CommandExecutionError

Browser session required for linkedin salesnav-inbox

Error message

Browser session required for linkedin salesnav-inbox

What it means

The salesnav-inbox command's func requires an active Playwright-style browser page to drive the Sales Navigator UI. If page is null/undefined the command cannot navigate to SALES_INBOX_URL, so it throws a CommandExecutionError immediately.

Source

Thrown at clis/linkedin/salesnav-inbox.js:182

export { THREAD_DECORATION, THREADS_BASE };

cli({
  site: 'linkedin',
  name: 'salesnav-inbox',
  access: 'read',
  description: 'List LinkedIn Sales Navigator message conversations with API pagination',
  domain: LINKEDIN_DOMAIN,
  strategy: Strategy.UI,
  browser: true,
  args: [
    { name: 'limit', type: 'number', default: DEFAULT_LIMIT, help: 'Maximum conversations to return (1-500)' },
    { name: 'max-pages', type: 'number', default: 30, help: 'Maximum Sales Navigator API pages to fetch' },
    { name: 'unread-only', type: 'bool', default: false, help: 'Return only unread conversations' },
  ],
  columns: ['rank', 'thread_id', 'thread_url', 'person_name', 'last_message_snippet', 'last_activity_time', 'unread', 'unread_count', 'total_message_count', 'archived', 'participants', 'next_page_starts_at'],
  func: async (page, args) => {
    if (!page) throw new CommandExecutionError('Browser session required for linkedin salesnav-inbox');
    const limit = parseLimit(args.limit);
    const maxPages = parseLimit(args['max-pages'], 30);
    await page.goto(SALES_INBOX_URL);
    await page.wait(4);
    let rows = await fetchInboxRows(page, { limit, maxPages });
    if (args['unread-only']) rows = rows.filter((row) => row.unread);
    if (rows.length === 0) {
      if (args['unread-only']) return [];
      throw new EmptyResultError('linkedin salesnav-inbox', 'No Sales Navigator conversations were found.');
    }
    return rows.slice(0, limit).map((row, index) => ({ ...row, rank: index + 1 }));
  },
});

export const __test__ = {
  THREAD_DECORATION,
  normalizeWhitespace,
  parseLimit,

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Start/authenticate a browser session for linkedin commands before running salesnav-inbox (e.g. via the CLI's login/session flow).
  2. Re-run the command normally through the CLI so it receives a live page object.
  3. If calling func directly, pass the authenticated page instance as the first argument.
Defensive patterns

Strategy: validation

Validate before calling

if (!page) throw new Error('Open and authenticate a browser session before running salesnav-inbox');

Type guard

function hasPage(page) { return Boolean(page && typeof page.goto === 'function' && typeof page.wait === 'function'); }

Try / catch

try { await run('linkedin salesnav-inbox'); } catch (e) { if (/Browser session required/.test(e.message)) { await login(); await run('linkedin salesnav-inbox'); } else throw e; }

Prevention

When it happens

Trigger: Calling the command's func with page undefined — i.e., no logged-in browser session was supplied to the CLI runner.

Common situations: Running the command without first opening/authenticating a browser session (e.g. missing linkedin login step); invoking func programmatically without passing a page object; session was closed before the command ran.

Related errors


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