{"record":{"id":"ef191d01a2eedd88","repo":"jackwener/OpenCLI","slug":"browser-session-required-for-linkedin-people-searc","errorCode":null,"errorMessage":"Browser session required for linkedin people-search","messagePattern":"Browser session required for linkedin people-search","errorType":"error_code","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/linkedin/people-search.js","lineNumber":191,"sourceCode":"    };\n  })()`;\n}\n\ncli({\n    site: 'linkedin',\n    name: 'people-search',\n    access: 'read',\n    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.',\n    domain: LINKEDIN_DOMAIN,\n    strategy: Strategy.COOKIE,\n    browser: true,\n    args: [\n        { name: 'keywords', type: 'string', required: true, positional: true, help: 'People search keywords, e.g. \"site reliability engineer berlin\"' },\n        { name: 'limit', type: 'int', default: 5, help: `Maximum people to return (1-${MAX_LIMIT}); each query counts toward LinkedIn's monthly CUL` },\n    ],\n    columns: ['rank', 'name', 'headline', 'location', 'profile_url'],\n    func: async (page, args) => {\n        if (!page) throw new CommandExecutionError('Browser session required for linkedin people-search');\n        const keywords = requireStringArg(args, 'keywords', '--keywords');\n        const limit = parseLimit(args.limit);\n\n        try {\n            await page.goto(buildSearchUrl(keywords));\n            await page.wait(6);\n        } catch (error) {\n            throw new CommandExecutionError(`LinkedIn people search navigation failed: ${error?.message || error}`);\n        }\n\n        let cookies;\n        try {\n            cookies = await page.getCookies({ url: 'https://www.linkedin.com' });\n        } catch (error) {\n            throw new CommandExecutionError(`LinkedIn cookie lookup failed: ${error?.message || error}`);\n        }\n        if (!Array.isArray(cookies)) {\n            throw new CommandExecutionError('LinkedIn cookie lookup returned malformed payload');","sourceCodeStart":173,"sourceCodeEnd":209,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/linkedin/people-search.js#L173-L209","documentation":"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).","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\nawait run('linkedin people-search', { keywords: 'sre berlin' });\n// after\nconst page = await client.newPage(); // or pass --browser flag on CLI\nawait run('linkedin people-search', { keywords: 'sre berlin' }, { page });","handlingStrategy":"validation","validationCode":"if (!page || typeof page.goto !== 'function') {\n  throw new Error('linkedin people-search needs a browser page; launch a session first');\n}","typeGuard":"const isPage = (p) => p != null && typeof p === 'object' && typeof p.goto === 'function' && typeof p.evaluate === 'function';","tryCatchPattern":"try { await runPeopleSearch(args); } catch (e) { if (/Browser session required/.test(e.message)) { await launchBrowserSession(); return runPeopleSearch(args); } throw e; }","preventionTips":["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"],"tags":["browser-session","linkedin","puppeteer","prerequisite"],"backgroundTag":"browser-session-required","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}