jackwener/OpenCLI · warning · AuthRequiredError

Waiting for Google session cookies

Error message

Waiting for Google session cookies

What it means

An AuthRequiredError thrown by the login poll loop while waiting for the user to finish Google sign-in. During `opencli gemini login`, the poller checks for session cookies; until SID/SAPISID appear it keeps reporting 'Waiting for Google session cookies' instead of proceeding to full identity verification.

Source

Thrown at clis/gemini/auth.js:44

      }
      return { ok: true, name: m[1].trim() };
    })()
  `);
  if (probe?.kind === 'auth') throw new AuthRequiredError('gemini.google.com', probe.detail);
  if (!probe?.ok) throw new CommandExecutionError(`Unexpected Gemini probe: ${JSON.stringify(probe)}`);
  return { name: probe.name };
}

registerSiteAuthCommands({
  site: 'gemini',
  domain: 'gemini.google.com',
  loginUrl: 'https://accounts.google.com/ServiceLogin?continue=https%3A%2F%2Fgemini.google.com%2F',
  columns: ['name'],
  quickCheck: hasGoogleSessionCookie,
  verify: verifyGeminiIdentity,
  poll: async (page) => {
    if (!await hasGoogleSessionCookie(page)) {
      throw new AuthRequiredError('gemini.google.com', 'Waiting for Google session cookies');
    }
    return verifyGeminiIdentity(page);
  },
});

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Complete the Google sign-in (including 2FA) inside the automation browser window
  2. Ensure you log in to the same profile the CLI automates (not your personal browser)
  3. Wait for the poll to re-check — this error during polling is expected until cookies are set
  4. Verify network access to accounts.google.com and that no extension clears cookies

Example fix

// no code fix — operational
// 1. opencli gemini login
// 2. finish sign-in (incl. 2FA) in the automated browser
// 3. poll succeeds once SID/SAPISID cookies exist
Defensive patterns

Strategy: retry

Validate before calling

const cookies = await getCookies('https://accounts.google.com');
if (!cookies.some(c => ['SID','SAPISID','__Secure-1PSID'].includes(c.name))) {
  console.log('Finish sign-in (incl. 2FA) in the automated browser...');
}

Type guard

function sessionReady(cookies) {
  return cookies.some(c => ['SID','SAPISID','__Secure-1PSID'].includes(c.name));
}

Try / catch

try {
  await pollLogin();
} catch (e) {
  if (e.name === 'AuthRequiredError' && /Waiting for Google session cookies/.test(e.message)) {
    // expected during login — keep polling or prompt user to complete sign-in
  } else throw e;
}

Prevention

When it happens

Trigger: During login polling: `hasGoogleSessionCookie(page)` still false after the user was given the Google login URL — cookies not yet set in the automation browser.

Common situations: User hasn't completed the Google sign-in yet; 2FA/challenge pending; login done in a different browser than the automation one; cookies immediately cleared by settings; login page blocked by network policy.

Related errors


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