jackwener/OpenCLI · warning · AuthRequiredError

Waiting for Twitter/X auth cookies

Error message

Waiting for Twitter/X auth cookies

What it means

The twitter site's poll handler checks session cookies before each verification while the user is completing login; if cookies are not yet present it throws AuthRequiredError('x.com', 'Waiting for Twitter/X auth cookies'). This is an expected, transient signal during the interactive login wait loop telling the caller the user hasn't finished logging in yet.

Source

Thrown at clis/twitter/auth.js:79

  const username = phase === 'poll'
    ? await readScreenName(page)
    : await readSettledScreenName(page);
  if (!username) {
    throw new AuthRequiredError('x.com', 'Could not detect the logged-in Twitter/X profile link');
  }
  return { username, url: `https://x.com/${username}` };
}

registerSiteAuthCommands({
  site: 'twitter',
  domain: 'x.com',
  loginUrl: 'https://x.com/i/flow/login',
  columns: ['username', 'url'],
  quickCheck: hasTwitterSessionCookies,
  verify: verifyTwitterIdentity,
  poll: async (page, options) => {
    if (!await hasTwitterSessionCookies(page)) {
      throw new AuthRequiredError('x.com', 'Waiting for Twitter/X auth cookies');
    }
    return verifyTwitterIdentity(page, options);
  },
});

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Complete the x.com login in the opened browser window (including 2FA).
  2. Keep the polling command running until cookies appear instead of aborting on the first poll.
  3. If headless/automated, supply a persisted profile that already has a valid x.com session.
  4. Confirm the login page (https://x.com/i/flow/login) actually loaded for the user.

Example fix

// before
await cli.run('auth login x.com', { timeout: 5000 });
// after
await cli.run('auth login x.com', { timeout: 120000 }); // allow time for manual login + 2FA
Defensive patterns

Strategy: retry

Validate before calling

const cookies = await getCookies('x.com');
if (!cookies.some((c) => c.name === 'auth_token')) {
  console.log('Waiting for you to complete x.com login...');
}

Try / catch

try {
  await auth.waitForLogin('twitter', { timeout: 120000 });
} catch (e) {
  if (/Waiting for Twitter\/X auth cookies/.test(e.message)) {
    // keep polling — user still completing login/2FA
    return auth.waitForLogin('twitter', { timeout: 120000 });
  }
  throw e;
}

Prevention

When it happens

Trigger: The auth login poll for x.com runs while the user has not yet submitted credentials/confirmed login in the browser, so hasTwitterSessionCookies still returns false.

Common situations: User is slow to type credentials or solve 2FA/captcha during login; a headless run where no one is completing the login; wrong login URL opened; user logged into a different browser profile than the one polled.

Related errors


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