jackwener/OpenCLI · error · AuthRequiredError
LinkedIn thread-snapshot requires an active signed-in Linked
Error message
LinkedIn thread-snapshot requires an active signed-in LinkedIn browser session.
What it means
After discovery, if the payload reports authRequired for the LinkedIn domain, the command throws AuthRequiredError because messengerMessages API interception only works inside a signed-in session. This is the library's explicit signal that your LinkedIn cookies/session expired or the page was redirected to login.
Source
Thrown at clis/linkedin/thread-snapshot.js:336
await page.wait(10);
let discovery = unwrapEvaluateResult(await page.evaluate(buildThreadApiDiscoveryScript(maxScrolls)));
if (discovery && Array.isArray(discovery.apiUrls) && discovery.apiUrls.length === 0) {
const firstDiscovery = discovery;
await page.wait(4);
const retried = unwrapEvaluateResult(await page.evaluate(buildThreadApiDiscoveryScript(0)));
if (retried && typeof retried === 'object' && !Array.isArray(retried)) {
discovery = {
...retried,
scrollAttempts: firstDiscovery.scrollAttempts,
scrollStable: firstDiscovery.scrollStable,
};
} else {
discovery = retried;
}
}
if (discovery?.authRequired) {
throw new AuthRequiredError(LINKEDIN_DOMAIN, 'LinkedIn thread-snapshot requires an active signed-in LinkedIn browser session.');
}
if (!discovery || typeof discovery !== 'object' || Array.isArray(discovery) || !Array.isArray(discovery.apiUrls)) {
throw new CommandExecutionError('LinkedIn thread-snapshot returned a malformed API discovery payload.');
}
const actualUrl = canonicalizeLinkedInThreadUrl(discovery.url || '');
if (threadUrl && actualUrl && threadUrl !== actualUrl) {
throw new CommandExecutionError('LinkedIn thread-snapshot blocked: thread_url_mismatch', `Expected ${threadUrl}; actual ${actualUrl}`);
}
if (maxScrolls >= 4 && discovery.scrollAttempts >= maxScrolls && discovery.scrollStable === false) {
throw new CommandExecutionError('LinkedIn thread history did not stabilize before --max-scrolls; refusing to return a partial snapshot.');
}
const apiUrls = validateThreadApiUrls(discovery.apiUrls, threadUrl);
const csrf = await requireLinkedInCookie(page, 'LinkedIn thread-snapshot');
const fetched = unwrapEvaluateResult(
await page.evaluate(buildFetchThreadPagesScript(apiUrls, csrf)),
);View on GitHub (pinned to 49907e53dc)
Solutions
- Re-authenticate: sign in to LinkedIn in the browser session and refresh cookies before re-running
- Load fresh cookies from a recently signed-in browser profile into your session store
- Check whether LinkedIn is showing a security challenge and complete it manually once
- Avoid hammering the endpoint — back off if repeated runs trigger forced re-login
Example fix
// before: stale cookie jar
session.cookies = staleCookies;
await run('linkedin thread-snapshot', { 'thread-url': url });
// after: refresh cookies from an authenticated profile first
session.cookies = await loadFreshLinkedInCookies();
await run('linkedin thread-snapshot', { 'thread-url': url }); Defensive patterns
Strategy: try-catch
Validate before calling
// Before running, verify the session is signed in
const res = await page.goto('https://www.linkedin.com/feed/');
if (/login|checkpoint/.test(res.url())) {
throw new Error('LinkedIn session expired; re-authenticate first');
} Try / catch
try {
const snap = await run('linkedin thread-snapshot', { 'thread-url': url });
} catch (err) {
if (err instanceof AuthRequiredError || String(err.message).includes('signed-in LinkedIn browser session')) {
await refreshLinkedInSession(); // sign in / reload cookies, then retry once
} else throw err;
} Prevention
- Refresh LinkedIn cookies regularly in long-running automations
- Detect login-wall redirects before running commands
- Complete LinkedIn security challenges promptly; avoid high request rates
When it happens
Trigger: Running with expired/invalid LinkedIn session cookies; LinkedIn redirecting the browser to the login wall; using a profile that was signed out between runs; hitting LinkedIn's auth challenge after suspicious activity.
Common situations: Long-lived automation sessions whose cookies aged out; running from a new IP triggering re-auth; sharing accounts across machines invalidating sessions; rate-limit-driven logout.
Related errors
- LinkedIn JSESSIONID cookie not found. Please sign in to Link
- LinkedIn JSESSIONID cookie not found. Please sign in to Link
- ${context} requires an active signed-in LinkedIn browser ses
- ${context} requires an active signed-in LinkedIn browser ses
- LinkedIn messengerMessages API authentication failed: ${fetc
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/c6d1320a7f395ed3.
Report an issue: GitHub.