jackwener/OpenCLI · critical · AuthRequiredError

Sign in to grok.com in the browser, then retry.

Error message

Sign in to grok.com in the browser, then retry.

What it means

AuthRequiredError thrown by collectHistory when the in-page history export reports code 'AUTH', meaning Grok redirected to a sign-in flow. The library requires an already-authenticated browser session before it can open the export-all history dialog.

Source

Thrown at clis/grok/export-all.js:151

      collect();
      if (targetLimit > 0 && seen.size >= targetLimit) break;
      if (seen.size === lastCount && scroller.scrollHeight === lastHeight) {
        stableRounds += 1;
      } else {
        stableRounds = 0;
        lastCount = seen.size;
        lastHeight = scroller.scrollHeight;
      }
      if (targetLimit === 0 && stableRounds >= 8) break;
    }

    return { ok: true, rows: Array.from(seen.values()) };
  })()`);

  const result = requireObjectEvaluateResult(rawResult, 'grok export-all history dialog');
  if (result.ok !== true) {
    if (result?.code === 'AUTH') {
      throw new AuthRequiredError(GROK_DOMAIN, 'Sign in to grok.com in the browser, then retry.');
    }
    if (result?.code === 'NO_DIALOG') {
      throw new TimeoutError('grok export-all history dialog', 8);
    }
    throw new EmptyResultError('grok export-all', 'No Grok conversation history was visible.');
  }
  const validRows = normalizeConversationRows(result.rows, 'grok export-all history dialog');
  if (!validRows.length) {
    throw new EmptyResultError('grok export-all', 'No Grok conversations found in the signed-in account history.');
  }
  return limit ? validRows.slice(offset, offset + limit) : validRows.slice(offset);
}

async function readConversation(page, conversation, { pageTimeoutMs, pageScrolls, delayMinMs, delayMaxMs }) {
  await page.goto(conversation.url);
  const startedAt = Date.now();
  let loaded = false;

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Open grok.com in the automation browser and sign in manually, then retry
  2. Reuse a persistent browser profile where you already logged in
  3. Point the CLI at the profile/user-data-dir holding valid cookies
  4. Re-authenticate and confirm your account loads the history page before running the export

Example fix

// before
npx grok export-all # fresh profile, no session
// after
# 1) launch browser with persistent profile, sign in to grok.com
# 2) npx grok export-all --profile ./browser-profile
Defensive patterns

Strategy: try-catch

Validate before calling

// pre-check: session cookie present in the automation profile
const cookies = await browser.cookies({ domain: 'grok.com' });
if (!cookies.some(c => c.name.includes('session') || c.name.includes('auth'))) console.warn('No Grok session cookie — sign in first');

Try / catch

try { await cli.exportAll(); } catch (e) { if (e.name === 'AuthRequiredError') { await openBrowserAndSignIn(); return cli.exportAll(); } throw e; }

Prevention

When it happens

Trigger: clis/grok/export-all.js:151 throws when the evaluate result from the history-dialog script returns { ok:false, code:'AUTH' } — the page is not signed in to grok.com.

Common situations: Cookie/session expired; running in a fresh browser profile that never logged in; incognito profile; corporate proxy or region forcing a login wall.

Related errors


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