jackwener/OpenCLI · error · CommandExecutionError

LinkedIn warning/restriction state visible on sent invitatio

Error message

LinkedIn warning/restriction state visible on sent invitations page.

What it means

The extraction script scans the sent-invitations page for LinkedIn restriction signals: captcha, 'verification required', 'unusual activity', 'account restricted', 'security check', or 'checkpoint' text. If found, the command refuses to scrape (both to protect the account and to avoid garbage data) and throws this CommandExecutionError.

Source

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

  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) => ({
      rank: index + 1,
      name: row.name || '',
      profile_url: row.profile_url || '',

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Stop automated calls immediately and open the page manually in the browser to complete any captcha/security challenge LinkedIn is presenting.
  2. Check your account status at linkedin.com — if restricted, follow LinkedIn's recovery flow before resuming.
  3. Reduce scraping frequency, add delays between commands, and run from a residential IP rather than a datacenter/VPN.
  4. Once the page renders normally (no warning banners) in the browser, re-run the command.

Example fix

// before (retrying through a captcha makes it worse)
for (let i = 0; i < 5; i++) { await run(['linkedin', 'sent-invitations']); await sleep(5000); }
// after — pause automation until the challenge is cleared manually
try { await run(['linkedin', 'sent-invitations']); }
catch (e) {
  if (/warning\/restriction/.test(e.message)) {
    console.error('Complete the LinkedIn challenge in the browser, then retry.');
    process.exit(1);
  }
}
Defensive patterns

Strategy: try-catch

Validate before calling

// Inspect the page before running: abort if LinkedIn is showing restriction banners
const result = await page.evaluate(() => document.body?.innerText?.slice(0, 4000) || '');
const restricted = /captcha|verification required|unusual activity|account restricted|temporarily restricted|security check|checkpoint/i.test(result);
if (restricted) {
  console.error('LinkedIn is showing a restriction/challenge page — resolve it manually before automating.');
  process.exit(2);
}

Type guard

const showsRestriction = (pageText) =>
  /captcha|verification required|unusual activity|account restricted|temporarily restricted|security check|checkpoint/i.test(String(pageText || ''));

Try / catch

try {
  const rows = await run(['linkedin', 'sent-invitations']);
} catch (e) {
  if (/warning\/restriction state/.test(e.message)) {
    console.error('Pause all LinkedIn automation; complete the challenge/restriction manually, then resume slowly.');
    process.exit(2); // do NOT auto-retry through a restriction
  }
  throw e;
}

Prevention

When it happens

Trigger: Running `opencli linkedin sent-invitations` while the rendered page contains restriction text, e.g. the account is temporarily restricted, LinkedIn interposes a captcha/security-check challenge, or an 'unusual activity' banner is shown.

Common situations: Aggressive scraping volume tripping LinkedIn's anti-automation; account already flagged/restricted by LinkedIn; running from a flagged IP (VPN/datacenter); LinkedIn A/B-serving a security challenge to the session.

Related errors


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