jackwener/OpenCLI · warning · AuthRequiredError

Waiting for GitHub session cookies

Error message

Waiting for GitHub session cookies

What it means

The GitHub site auth poll function checks hasGithubSessionCookies(page) on each polling tick during the interactive login flow and throws AuthRequiredError while the session cookies are absent. It is a transient 'not yet logged in' signal: once GitHub session cookies appear, polling proceeds to verifyGithubIdentity.

Source

Thrown at clis/github/auth.js:40

  }
  return {
    id: identity.id || '',
    username: identity.username,
    name: identity.name || '',
    url: `https://github.com/${identity.username}`,
  };
}

registerSiteAuthCommands({
  site: 'github',
  domain: 'github.com',
  loginUrl: 'https://github.com/login',
  columns: ['id', 'username', 'name', 'url'],
  quickCheck: hasGithubSessionCookies,
  verify: verifyGithubIdentity,
  poll: async (page) => {
    if (!await hasGithubSessionCookies(page)) {
      throw new AuthRequiredError('github.com', 'Waiting for GitHub session cookies');
    }
    return verifyGithubIdentity(page);
  },
});

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Complete the GitHub login in the browser window before/while polling continues
  2. Check that the browser context allows cookies (not incognito with blockers, no extension stripping cookies)
  3. Increase poll timeout to accommodate 2FA / SSO delays
  4. Use a persistent user-data-dir profile so cookies survive restarts

Example fix

// before
await loginAndPoll(site, { timeout: 10_000 }); // too short for 2FA
// after
await loginAndPoll(site, { timeout: 120_000 }); // allow time for manual login + 2FA
Defensive patterns

Strategy: retry

Validate before calling

const cookies = await page.cookies('https://github.com');
const hasSession = cookies.some(c => c.name === 'user_session' || c.name === '__Host-user_session_same-site');
if (!hasSession) await waitForGithubLogin(page, { timeoutMs: 120_000 });

Type guard

function hasGithubSession(cookies) {
  return Array.isArray(cookies) && cookies.some(c => c.name === 'user_session');
}

Try / catch

withRetries(async () => {
  try { return await pollGithubAuth(page); }
  catch (e) {
    if (e instanceof AuthRequiredError && /Waiting for GitHub session cookies/.test(e.message)) return null; // keep polling
    throw e;
  }
}, { until: r => r !== null, timeoutMs: 120_000 });

Prevention

When it happens

Trigger: During the login/poll loop for site 'github', a poll tick runs hasGithubSessionCookies(page) and it resolves false — the browser has not yet obtained GitHub session cookies (user hasn't completed login, or cookies were dropped).

Common situations: User hasn't finished the GitHub login form when polling starts; GitHub login requires 2FA and takes longer than expected; browser profile discards cookies (private mode, cookie blockers, third-party cookie restrictions); script closed the browser before cookies persisted.

Related errors


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