jackwener/OpenCLI · info · AuthRequiredError

Waiting for LinkedIn li_at cookie

Error message

Waiting for LinkedIn li_at cookie

What it means

The login-flow poll callback checks hasLinkedinSessionCookie on every poll tick; until the li_at cookie appears it throws AuthRequiredError('linkedin.com', 'Waiting for LinkedIn li_at cookie') to signal 'not finished yet'. The auth harness treats these polls as retryable and keeps waiting for the user to complete login.

Source

Thrown at clis/linkedin/auth.js:58

    }
  })()`);
  if (result?.kind === 'auth') throw new AuthRequiredError('linkedin.com', result.detail);
  if (result?.kind === 'http') throw new CommandExecutionError(`HTTP ${result.httpStatus} from /voyager/api/me`);
  if (result?.kind === 'exception') throw new CommandExecutionError(`LinkedIn whoami failed: ${result.detail}`);
  if (!result?.ok) throw new CommandExecutionError(`Unexpected LinkedIn probe: ${JSON.stringify(result)}`);
  return { public_id: result.public_id, plain_id: result.plain_id, name: result.name };
}

registerSiteAuthCommands({
  site: 'linkedin',
  domain: 'www.linkedin.com',
  loginUrl: 'https://www.linkedin.com/login',
  columns: ['public_id', 'plain_id', 'name'],
  quickCheck: hasLinkedinSessionCookie,
  verify: verifyLinkedinIdentity,
  poll: async (page) => {
    if (!await hasLinkedinSessionCookie(page)) {
      throw new AuthRequiredError('linkedin.com', 'Waiting for LinkedIn li_at cookie');
    }
    return verifyLinkedinIdentity(page);
  },
});

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Complete the LinkedIn login in the automated browser window — this error clears once li_at is set.
  2. If login was rejected, retry with correct credentials and complete any 2FA/captcha.
  3. Increase poll timeout if the human user needs more time.
  4. If it persists after successful login, check that cookies are being persisted to the right profile (hasLinkedinSessionCookie quickCheck).

Example fix

// before
await auth('linkedin', { timeout: 5000 }); // keeps throwing 'Waiting for LinkedIn li_at cookie'
// after
await auth('linkedin', { timeout: 300000 }); // give the user time to log in
Defensive patterns

Strategy: retry

Validate before calling

const cookies = await page.getCookies({ url: 'https://www.linkedin.com' });
const ready = cookies.some(c => c.name === 'li_at' && c.value); // poll until ready

Type guard

null

Try / catch

// during login flow, treat this as 'not ready yet'
try {
  await pollAuth();
} catch (e) {
  if (/Waiting for LinkedIn li_at cookie/.test(e.message)) {
    return scheduleNextPoll(); // keep waiting for user login
  }
  throw e;
}

Prevention

When it happens

Trigger: During interactive login the poll runs before the user has submitted credentials, or login failed/stalled so li_at never gets set — each poll raises this until the cookie exists.

Common situations: User simply hasn't finished typing credentials yet (benign, expected); login attempt failed (wrong password, blocked by 2FA/captcha); login page stuck due to headless-browser detection.

Related errors


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