jackwener/OpenCLI · error · CommandExecutionError
Browser session required for linkedin salesnav-thread
Error message
Browser session required for linkedin salesnav-thread
What it means
The linkedin salesnav-thread command's func requires a live Puppeteer-style Page; if the page argument is falsy it throws CommandExecutionError('Browser session required for ...'). All resolution (inbox scraping, CSRF extraction, API calls via page.evaluate) depends on an authenticated browser context, so the command cannot run headless-without-browser.
Source
Thrown at clis/linkedin/salesnav-thread.js:185
return thread;
}
cli({
site: 'linkedin',
name: 'salesnav-thread',
access: 'read',
description: 'Return full Sales Navigator message history for a thread id, Sales Navigator inbox URL, lead URL, recipient urn, or exact recipient name',
domain: LINKEDIN_DOMAIN,
strategy: Strategy.UI,
browser: true,
args: [
{ name: 'thread-or-recipient', type: 'string', required: true, positional: true, help: 'Sales Navigator inbox URL/thread id, Sales Navigator lead URL, recipient urn, or exact participant name' },
{ name: 'limit', type: 'number', default: DEFAULT_MESSAGE_LIMIT, help: 'Maximum messages to return (1-500)' },
{ name: 'max-pages', type: 'number', default: 30, help: 'Maximum inbox pages to scan when resolving a recipient' },
],
columns: ['index', 'thread_id', 'thread_url', 'sender', 'text', 'timestamp', 'subject', 'message_id', 'sender_urn', 'delivered_at', 'type', 'total_message_count'],
func: async (page, args) => {
if (!page) throw new CommandExecutionError('Browser session required for linkedin salesnav-thread');
const input = normalizeWhitespace(args['thread-or-recipient']);
if (!input) throw new ArgumentError('thread-or-recipient is required');
const limit = parseLimit(args.limit, DEFAULT_MESSAGE_LIMIT);
const maxPages = parseLimit(args['max-pages'], 30);
await page.goto(SALES_INBOX_URL);
await page.wait(4);
const threadId = await resolveThreadId(page, input, { maxPages });
const csrf = await getCsrf(page);
const thread = await fetchThreadWithPagination(page, csrf, threadId, limit);
const messages = parseSalesnavThreadMessages(thread).slice(0, limit);
if (messages.length === 0) throw new EmptyResultError('linkedin salesnav-thread', `No messages found for ${threadId}`);
return messages.map((message) => ({
...message,
thread_url: salesnavThreadUrl(threadId),
total_message_count: Number(thread?.totalMessageCount || messages.length),
}));
},
});View on GitHub (pinned to 49907e53dc)
Solutions
- Start the CLI/browser harness so a logged-in LinkedIn session page is available before running the command (e.g. the site's standard 'open/login' flow).
- Verify the browser launched successfully and the page handle is passed through to the command dispatcher.
- In tests, pass a stub page object or mark the test as requiring a browser session.
- Check CI images include a working Chrome/Chromium and non-headless-safe flags if applicable.
Example fix
// before
await cli.run(['linkedin','salesnav-thread', threadId]) // no browser session
// after
await browserSession.login('linkedin') // establish signed-in page
await cli.run(['linkedin','salesnav-thread', threadId], { page }) Defensive patterns
Strategy: validation
Validate before calling
if (!page) throw new Error('launch/login to a browser session before running linkedin salesnav-thread'); Type guard
function isPage(p){ return !!p && typeof p.goto === 'function' && typeof p.evaluate === 'function'; } Try / catch
try { await run() } catch (e) { if (/Browser session required/.test(e.message)) { await startBrowserAndLogin(); await run(); } else throw e; } Prevention
- Always establish (and verify) the browser/login session before LinkedIn commands.
- In tests, inject a stub page or skip browser-requiring tests.
- Ensure CI images ship Chrome and correct launch flags.
- Fail the pipeline early if the browser harness reports no page handle.
When it happens
Trigger: Invoking the linkedin salesnav-thread CLI without starting/attaching a browser session, so the CLI harness passes page = null/undefined into func.
Common situations: Running the command in an environment where the browser flag/wrapper was omitted; a browser launch failure silently yielding no page; calling func directly in tests without a fixture page; CI containers lacking Chrome.
Related errors
- Browser session required for instagram note
- Browser session required for linkedin people-search
- 12306 whoami failed: ${probe.detail}
- Browser session required for bilibili comment
- Browser session required for bilibili summary
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/08ad16e3238966b5.
Report an issue: GitHub.