jackwener/OpenCLI · error · CommandExecutionError
Browser session required for linkedin people-search
Error message
Browser session required for linkedin people-search
What it means
The linkedin people-search command drives a real browser via Puppeteer-style page automation; without a page object it cannot navigate or scrape. The command's func entrypoint checks its page argument and throws CommandExecutionError immediately when the CLI was invoked without an active browser session (e.g. no --browser/session flag).
Source
Thrown at clis/linkedin/people-search.js:191
};
})()`;
}
cli({
site: 'linkedin',
name: 'people-search',
access: 'read',
description: 'Search standard LinkedIn (not Sales Navigator) for people by keyword. Each invocation consumes against LinkedIn\'s monthly Commercial Use Limit on people search; throttle accordingly.',
domain: LINKEDIN_DOMAIN,
strategy: Strategy.COOKIE,
browser: true,
args: [
{ name: 'keywords', type: 'string', required: true, positional: true, help: 'People search keywords, e.g. "site reliability engineer berlin"' },
{ name: 'limit', type: 'int', default: 5, help: `Maximum people to return (1-${MAX_LIMIT}); each query counts toward LinkedIn's monthly CUL` },
],
columns: ['rank', 'name', 'headline', 'location', 'profile_url'],
func: async (page, args) => {
if (!page) throw new CommandExecutionError('Browser session required for linkedin people-search');
const keywords = requireStringArg(args, 'keywords', '--keywords');
const limit = parseLimit(args.limit);
try {
await page.goto(buildSearchUrl(keywords));
await page.wait(6);
} catch (error) {
throw new CommandExecutionError(`LinkedIn people search navigation failed: ${error?.message || error}`);
}
let cookies;
try {
cookies = await page.getCookies({ url: 'https://www.linkedin.com' });
} catch (error) {
throw new CommandExecutionError(`LinkedIn cookie lookup failed: ${error?.message || error}`);
}
if (!Array.isArray(cookies)) {
throw new CommandExecutionError('LinkedIn cookie lookup returned malformed payload');View on GitHub (pinned to 49907e53dc)
Solutions
- Launch a browser session first (e.g. pass the session/browser flag) so page is non-null, then retry the command
- Use a command that does not require a browser if you only need non-scraping data
- In code, launch the browser and pass the page handle into the command func
- Check the command's arg definitions/help for the browser-session requirement
Example fix
// before
await run('linkedin people-search', { keywords: 'sre berlin' });
// after
const page = await client.newPage(); // or pass --browser flag on CLI
await run('linkedin people-search', { keywords: 'sre berlin' }, { page }); Defensive patterns
Strategy: validation
Validate before calling
if (!page || typeof page.goto !== 'function') {
throw new Error('linkedin people-search needs a browser page; launch a session first');
} Type guard
const isPage = (p) => p != null && typeof p === 'object' && typeof p.goto === 'function' && typeof p.evaluate === 'function';
Try / catch
try { await runPeopleSearch(args); } catch (e) { if (/Browser session required/.test(e.message)) { await launchBrowserSession(); return runPeopleSearch(args); } throw e; } Prevention
- Always pass the browser/session flag for scraping commands
- Assert page is non-null in wrappers before invoking command funcs
- Document the browser prerequisite in your tooling's help text
- Fail fast at startup if the browser cannot launch, before reaching search commands
When it happens
Trigger: Running `linkedin people-search` without establishing a browser session (page === null/undefined), such as invoking the command in a non-browser context or without the required session/browser startup option.
Common situations: Forgetting the --browser/session flag on the CLI; running the command in a headless script that never launched the browser; using an API wrapper that calls the command func with page omitted; browser failed to launch earlier and page defaulted to null.
Related errors
- Browser session required for linkedin salesnav-thread
- 12306 whoami failed: ${probe.detail}
- Browser session required for bilibili comment
- Browser session required for bilibili summary
- Browser session required for facebook marketplace-inbox
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/ef191d01a2eedd88.
Report an issue: GitHub.