{"record":{"id":"2a709586d4575a85","repo":"jackwener/OpenCLI","slug":"linkedin-sent-invitations-verification-requires-an","errorCode":null,"errorMessage":"LinkedIn sent-invitations verification requires an active signed-in LinkedIn browser session.","messagePattern":"LinkedIn sent-invitations verification requires an active signed-in LinkedIn browser session\\.","errorType":"exception","errorClass":"AuthRequiredError","httpStatus":null,"severity":"error","filePath":"clis/linkedin/connect.js","lineNumber":492,"sourceCode":"        // no dialog to drive; treat it as sent and let the sent-invitations probe verify.\n        if (!result?.ok && result?.reason === 'invite_dialog_not_found' && !inviteHref) {\n            result = { ok: true, status: 'sent', reason: 'invitation_sent_no_dialog' };\n        }\n        if (!result?.ok) throw new CommandExecutionError(`LinkedIn connect blocked: ${result?.reason || 'send_failed'}`);\n        // LinkedIn can take a few seconds after the Send click to materialize the\n        // new invite in /mynetwork/invitation-manager/sent/. Wait before the\n        // first check, then retry page loads for propagation lag.\n        await page.wait(8);\n        let sentProbe = null;\n        for (let attempt = 0; attempt < 3; attempt += 1) {\n            await page.goto('https://www.linkedin.com/mynetwork/invitation-manager/sent/');\n            await page.wait(attempt === 0 ? 6 : 4);\n            sentProbe = unwrapEvaluateResult(await page.evaluate(buildSentInvitationsProbeScript(expectedName, profileUrl)));\n            if (sentProbe?.found || sentProbe?.authRequired) break;\n            if (attempt < 2) await page.wait(5);\n        }\n        if (sentProbe?.authRequired) {\n            throw new AuthRequiredError(LINKEDIN_DOMAIN, 'LinkedIn sent-invitations verification requires an active signed-in LinkedIn browser session.');\n        }\n        const verified = Boolean(sentProbe?.found);\n        return [{\n            status: verified ? 'sent_verified' : 'send_unverified',\n            recipient: safety.actualValue,\n            reason: verified ? 'sent_invitation_verified' : 'sent_invitation_not_found_after_retries',\n            profile_url: safety.observedUrl,\n            note_chars: note.length,\n            connectable: true,\n            delivery_verified: verified,\n            matched_invitation_name: sentProbe?.matchedName || '',\n            matched_invitation_url: sentProbe?.matchedUrl || '',\n        }];\n    },\n});\n\nexport const __test__ = {\n    normalizeWhitespace,","sourceCodeStart":474,"sourceCodeEnd":510,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/linkedin/connect.js#L474-L510","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before (expired session)\n$ opencli linkedin connect \"Jane Doe\" \nAuthRequiredError: LinkedIn sent-invitations verification requires an active signed-in LinkedIn browser session.\n// after\n$ opencli linkedin login   # or re-run connect and log in when the browser opens\n$ opencli linkedin connect \"Jane Doe\"","handlingStrategy":"retry","validationCode":"const cookies = await page.context().cookies('https://www.linkedin.com');\nif (!cookies.some(c => c.name === 'li_at' && new Date(c.expires * 1000) > new Date())) {\n  throw new Error('LinkedIn session cookie missing or expired — log in before running connect.');\n}","typeGuard":"function isAuthedProbe(probe) {\n  return probe !== null && typeof probe === 'object' && probe.authRequired !== true;\n}","tryCatchPattern":"try {\n  await opencli.linkedin.connect({ name: 'Jane Doe' });\n} catch (e) {\n  if (e.name === 'AuthRequiredError' && /linkedin/i.test(e.domain || e.message)) {\n    await opencli.linkedin.login(); // refresh browser session\n    return opencli.linkedin.connect({ name: 'Jane Doe' });\n  }\n  throw e;\n}","preventionTips":["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."],"tags":["linkedin","authentication","browser-session","cookies"],"backgroundTag":"browser-session-expired","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}