jackwener/OpenCLI · error · AuthRequiredError

LinkedIn people search requires an active signed-in browser

Error message

LinkedIn people search requires an active signed-in browser session.

What it means

When the extraction script reports result.error, the command checks the URL and error text with looksLinkedInAuthWall. If they look like LinkedIn's login/auth wall, it throws AuthRequiredError: the search results can only be viewed by a signed-in member, so the run must stop and the user must authenticate.

Source

Thrown at clis/linkedin/people-search.js:224

            throw new CommandExecutionError(`LinkedIn cookie lookup failed: ${error?.message || error}`);
        }
        if (!Array.isArray(cookies)) {
            throw new CommandExecutionError('LinkedIn cookie lookup returned malformed payload');
        }
        const jsession = cookies.find((c) => c.name === 'JSESSIONID')?.value;
        if (!jsession) {
            throw new AuthRequiredError(LINKEDIN_DOMAIN, 'LinkedIn JSESSIONID cookie not found. Please sign in to LinkedIn in the browser.');
        }

        let result;
        try {
            result = unwrapEvaluateResult(await page.evaluate(extractionScript()));
        } catch (error) {
            throw new CommandExecutionError(`LinkedIn people search extraction failed: ${error?.message || error}`);
        }
        if (result?.error) {
            if (looksLinkedInAuthWall(`${result.url || ''} ${result.error || ''}`)) {
                throw new AuthRequiredError(LINKEDIN_DOMAIN, 'LinkedIn people search requires an active signed-in browser session.');
            }
            // If LinkedIn redirected away from the search page that
            // usually means CUL was reached or the account is gated.
            throw new CommandExecutionError(`LinkedIn redirected away from the search page (${result.error}). Likely Commercial Use Limit reached - the limit resets on the 1st of next month.`);
        }
        if (!result || typeof result !== 'object') {
            throw new CommandExecutionError('LinkedIn people search returned malformed extraction payload');
        }
        const candidateCount = parseNonNegativeCount(result.candidate_count, 'candidate_count');
        parseNonNegativeCount(result.person_entries_count, 'person_entries_count');
        const resolvedCount = parseNonNegativeCount(result.resolved_count, 'resolved_count');
        const rows = normalizePeopleRows(result.rows);
        if (rows.length === 0 && (candidateCount > 0 || resolvedCount > 0)) {
            throw new CommandExecutionError('LinkedIn people search found profile candidates but could not parse stable result rows');
        }
        if (rows.length === 0) {
            throw new EmptyResultError(`No people found on the rendered page for "${keywords}". The search may have returned zero results, or the DOM markup may have changed.`);
        }

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Sign in to LinkedIn in the controlled browser, then re-run the search
  2. Refresh an expired session (log out and back in) to clear server-side invalidation
  3. Avoid rapid repeated searches that trigger LinkedIn's anti-bot re-auth
  4. Catch AuthRequiredError and route the user to an interactive login flow

Example fix

// before
await cli('linkedin people-search', { keywords: 'sre berlin' });
// after
await cli('browser open'); // complete LinkedIn login in the opened tab
await cli('linkedin people-search', { keywords: 'sre berlin' });
Defensive patterns

Strategy: try-catch

Validate before calling

// preflight: confirm a signed-in session before searching
const cookies = await page.getCookies({ url: 'https://www.linkedin.com' });
if (!cookies.some((c) => c.name === 'JSESSIONID' && c.value)) throw new Error('Sign in to LinkedIn before running people-search');

Type guard

null

Try / catch

try { await cli('linkedin people-search', args); }
catch (e) { if (e.name === 'AuthRequiredError' || /signed-in browser session/.test(e.message)) { await interactiveLinkedInLogin(); return retryOnce(); } throw e; }

Prevention

When it happens

Trigger: result.error set and result.url/error text matches LinkedIn auth-wall patterns — e.g. LinkedIn redirected the search to /login or an authwall subdomain because the browser session is not signed in.

Common situations: Running search against a never-signed-in browser profile; JSESSIONID present but session invalidated server-side; LinkedIn forcing re-auth after suspicious activity; using a region/IP that LinkedIn gates behind login.

Related errors


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