jackwener/OpenCLI · info · AuthRequiredError

Waiting for Doubao login

Error message

Waiting for Doubao login

What it means

During the interactive Doubao login flow, the CLI polls the page for a logged-in signal (d.data.user_id_str from the account check). As long as that signal is absent, it throws AuthRequiredError with this message so the driver keeps waiting for the user to log in. It is an expected state, not a bug: the browser session is simply not authenticated yet.

Source

Thrown at clis/doubao/auth.js:62

  site: 'doubao',
  domain: 'www.doubao.com',
  loginUrl: 'https://www.doubao.com/chat/',
  columns: ['user_id', 'name'],
  verify: verifyDoubaoIdentity,
  // passport_csrf_token is set for anonymous sessions too, so a cookie gate
  // would navigate away mid-login. Probe the account API on the current page
  // (no goto) and only confirm once a real user_id is present.
  poll: async (page) => {
    const loggedIn = await page.evaluate(`(async () => {
      try {
        const r = await fetch('/passport/account/info/v2/', { credentials: 'include', headers: { Accept: 'application/json' } });
        if (!r.ok) return false;
        const d = await r.json();
        return !!(d?.data?.user_id_str);
      } catch { return false; }
    })()`);
    if (!loggedIn) {
      throw new AuthRequiredError('www.doubao.com', 'Waiting for Doubao login');
    }
    return verifyDoubaoIdentity(page);
  },
});

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Complete the Doubao login in the opened browser window and wait for the flow to continue
  2. Keep the Doubao tab open until the CLI reports success
  3. Check network connectivity if the page never finishes loading
  4. Re-run the login command if the tab was closed or redirected

Example fix

// before (caller aborting on this error)
try { await login(); } catch (e) { console.error(e); }
// after
try { await login(); } catch (e) {
  if (!(e instanceof AuthRequiredError)) throw e; // keep waiting while login pending
}
Defensive patterns

Strategy: retry

Validate before calling

const r = await page.evaluate(async () => {
  const d = await (await fetch('/passport/account/info/')).json();
  return !!(d?.data?.user_id_str);
});
if (!r) console.log('Doubao login not yet complete; keep waiting');

Type guard

function isLoggedInPayload(d) { return typeof d?.data?.user_id_str === 'string' && d.data.user_id_str.length > 0; }

Try / catch

try {
  await waitForLogin(page);
} catch (e) {
  if (e instanceof AuthRequiredError && e.message === 'Waiting for Doubao login') {
    await waitForUserLoginWithTimeout(page, 120_000); // poll longer before giving up
  } else throw e;
}

Prevention

When it happens

Trigger: waitForLogin's polled page.evaluate returns loggedIn=false because the user has not completed the Doubao login in the browser, the login page was closed early, or the response lacks data.user_id_str.

Common situations: User delays entering credentials/2FA; login page redirects somewhere the poller can't read; cookies cleared mid-flow; slow network leaving the check endpoint unanswered.

Related errors


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