jackwener/OpenCLI · error · AuthRequiredError

LinkedIn sent invitations requires an active signed-in brows

Error message

LinkedIn sent invitations requires an active signed-in browser session.

What it means

After loading the LinkedIn invitation-manager page, the extraction script checks the body text and URL for sign-in/authwall markers. If result.authRequired is true, the command throws this AuthRequiredError because pending sent invitations are only visible to a signed-in account.

Source

Thrown at clis/linkedin/sent-invitations.js:96

}

cli({
  site: 'linkedin',
  name: 'sent-invitations',
  access: 'read',
  description: 'List pending LinkedIn sent invitations for CRM reconciliation',
  domain: LINKEDIN_DOMAIN,
  strategy: Strategy.UI,
  browser: true,
  args: [],
  columns: ['rank', 'name', 'profile_url', 'invited_date_text'],
  func: async (page) => {
    if (!page) throw new CommandExecutionError('Browser session required for linkedin sent-invitations');
    await page.goto(SENT_URL);
    await page.wait(12);
    let result = unwrapEvaluateResult(await page.evaluate(buildSentInvitationsScript()));
    if (result?.authRequired) {
      throw new AuthRequiredError(LINKEDIN_DOMAIN, 'LinkedIn sent invitations requires an active signed-in browser session.');
    }
    if (result?.warning) {
      throw new CommandExecutionError('LinkedIn warning/restriction state visible on sent invitations page.');
    }
    if (!result || typeof result !== 'object' || Array.isArray(result) || !Array.isArray(result.rows)) {
      throw new CommandExecutionError('LinkedIn sent invitations returned a malformed extraction payload.');
    }
    if (result.malformedCount > 0) {
      throw new CommandExecutionError('LinkedIn sent invitations contained a malformed invitation card.');
    }
    const rows = result.rows;
    if (rows.length === 0) {
      if (result.explicitEmpty) {
        throw new EmptyResultError('linkedin sent-invitations', 'No pending sent invitations were found.');
      }
      throw new CommandExecutionError('LinkedIn sent invitation cards were not found; the page structure may have changed.');
    }
    return rows.map((row, index) => ({

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Open the automation browser profile, sign in to LinkedIn manually (complete any checkpoint/challenge), then re-run the command.
  2. Verify you land on /mynetwork/invitation-manager/sent/ in that profile and can see invitations in the UI.
  3. Keep the browser profile persistent so the session cookie survives across runs, and avoid clearing cookies.
  4. If checkpoints recur, slow down usage frequency and avoid running from datacenter IPs that trigger LinkedIn security checks.

Example fix

// before (expired session -> authwall redirect)
await page.goto('https://www.linkedin.com/mynetwork/invitation-manager/sent/');
// after — verify sign-in state first
await page.goto('https://www.linkedin.com/feed/');
if (/login|checkpoint|authwall/.test(page.url())) {
  throw new Error('Sign in to LinkedIn in the automation browser before running sent-invitations');
}
Defensive patterns

Strategy: validation

Validate before calling

// Verify sign-in state before running the command
await page.goto('https://www.linkedin.com/feed/');
const url = page.url();
if (/linkedin\.com\/(login|checkpoint|authwall|uas)/.test(url)) {
  console.error('Not signed in: open the automation browser and complete LinkedIn sign-in first.');
  process.exit(2);
}

Type guard

const isAuthWall = ({ url = '', title = '', bodyText = '' }) =>
  /linkedin\.com\/(login|checkpoint|authwall|uas)/.test(url) ||
  /\b(sign in|log in|join linkedin)\b/i.test(`${title} ${bodyText}`);

Try / catch

try {
  const rows = await run(['linkedin', 'sent-invitations']);
} catch (e) {
  if (e.name === 'AuthRequiredError' || /active signed-in browser session/.test(e.message)) {
    console.error('LinkedIn session expired — sign in manually in the automation browser, then re-run.');
    process.exit(2);
  }
  throw e;
}

Prevention

When it happens

Trigger: Running `opencli linkedin sent-invitations` when the browser lands on a login, checkpoint, or authwall page instead of /mynetwork/invitation-manager/sent/ — body text matches /sign in|log in|join linkedin/ or the URL matches /linkedin.com\/(login|checkpoint|authwall|uas)/.

Common situations: LinkedIn session expired or was logged out between runs; cookies cleared by automation; LinkedIn redirected to a security checkpoint; wrong browser profile without a LinkedIn login; account flagged and forced re-authentication.

Related errors


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