jackwener/OpenCLI · error · AuthRequiredError
LinkedIn sent-invitations verification requires an active si
Error message
LinkedIn sent-invitations verification requires an active signed-in LinkedIn browser session.
What it means
The `linkedin connect` command verifies a sent invitation by probing LinkedIn's sent-invitations list inside the signed-in browser page (buildSentInvitationsProbeScript). When the probe reports authRequired, the page is not on an authenticated LinkedIn session, so verification cannot proceed and AuthRequiredError is thrown for LINKEDIN_DOMAIN. It is a signal to re-authenticate, not a send failure.
Source
Thrown at clis/linkedin/connect.js:492
// no dialog to drive; treat it as sent and let the sent-invitations probe verify.
if (!result?.ok && result?.reason === 'invite_dialog_not_found' && !inviteHref) {
result = { ok: true, status: 'sent', reason: 'invitation_sent_no_dialog' };
}
if (!result?.ok) throw new CommandExecutionError(`LinkedIn connect blocked: ${result?.reason || 'send_failed'}`);
// LinkedIn can take a few seconds after the Send click to materialize the
// new invite in /mynetwork/invitation-manager/sent/. Wait before the
// first check, then retry page loads for propagation lag.
await page.wait(8);
let sentProbe = null;
for (let attempt = 0; attempt < 3; attempt += 1) {
await page.goto('https://www.linkedin.com/mynetwork/invitation-manager/sent/');
await page.wait(attempt === 0 ? 6 : 4);
sentProbe = unwrapEvaluateResult(await page.evaluate(buildSentInvitationsProbeScript(expectedName, profileUrl)));
if (sentProbe?.found || sentProbe?.authRequired) break;
if (attempt < 2) await page.wait(5);
}
if (sentProbe?.authRequired) {
throw new AuthRequiredError(LINKEDIN_DOMAIN, 'LinkedIn sent-invitations verification requires an active signed-in LinkedIn browser session.');
}
const verified = Boolean(sentProbe?.found);
return [{
status: verified ? 'sent_verified' : 'send_unverified',
recipient: safety.actualValue,
reason: verified ? 'sent_invitation_verified' : 'sent_invitation_not_found_after_retries',
profile_url: safety.observedUrl,
note_chars: note.length,
connectable: true,
delivery_verified: verified,
matched_invitation_name: sentProbe?.matchedName || '',
matched_invitation_url: sentProbe?.matchedUrl || '',
}];
},
});
export const __test__ = {
normalizeWhitespace,View on GitHub (pinned to 49907e53dc)
Solutions
- Re-run the command and complete LinkedIn login interactively in the launched browser window so fresh session cookies are stored.
- Delete cached LinkedIn cookies/credentials for this CLI and re-authenticate from scratch.
- Check linkedin.com in a normal browser: resolve any security checkpoint or pending verification, then retry.
- Avoid running multiple sessions concurrently; sharing one LinkedIn session across machines invalidates cookies.
Example fix
// before (expired session) $ opencli linkedin connect "Jane Doe" AuthRequiredError: LinkedIn sent-invitations verification requires an active signed-in LinkedIn browser session. // after $ opencli linkedin login # or re-run connect and log in when the browser opens $ opencli linkedin connect "Jane Doe"
Defensive patterns
Strategy: retry
Validate before calling
const cookies = await page.context().cookies('https://www.linkedin.com');
if (!cookies.some(c => c.name === 'li_at' && new Date(c.expires * 1000) > new Date())) {
throw new Error('LinkedIn session cookie missing or expired — log in before running connect.');
} Type guard
function isAuthedProbe(probe) {
return probe !== null && typeof probe === 'object' && probe.authRequired !== true;
} Try / catch
try {
await opencli.linkedin.connect({ name: 'Jane Doe' });
} catch (e) {
if (e.name === 'AuthRequiredError' && /linkedin/i.test(e.domain || e.message)) {
await opencli.linkedin.login(); // refresh browser session
return opencli.linkedin.connect({ name: 'Jane Doe' });
}
throw e;
} Prevention
- Log in interactively before scripted runs so cookies are fresh.
- Check for li_at cookie expiry before long automation runs.
- Resolve LinkedIn security checkpoints promptly in a normal browser.
- Do not share one LinkedIn session across concurrent CLI runs.
When it happens
Trigger: Calling `linkedin connect <name/profile-url>` when the browser session's LinkedIn cookies have expired, the session was logged out, or the page was redirected to a login/checkpoint URL during the sent-invitation probe attempts.
Common situations: Stale saved cookies after weeks of non-use; LinkedIn forcing a security checkpoint (new device, suspicious activity); running headless with a session that was invalidated elsewhere; company SSO sessions that expire quickly.
Related errors
- LinkedIn JSESSIONID cookie not found. Please sign in to Link
- LinkedIn connections API authentication failed:
- LinkedIn requires an active signed-in browser session.
- LinkedIn JSESSIONID cookie not found. Please sign in to Link
- LinkedIn JSESSIONID cookie not found. Please sign in to Link
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/2a709586d4575a85.
Report an issue: GitHub.