jackwener/OpenCLI · error · AuthRequiredError

Waiting for zsxq login

Error message

Waiting for zsxq login

What it means

The zsxq login command polls the browser session to detect a completed login (checking that /v2/users/self returns resp_data.user). If the poll reports not-logged-in when the wait window ends, it throws AuthRequiredError('zsxq.com', 'Waiting for zsxq login') — meaning the user never finished logging in inside the browser.

Solutions

  1. Complete the zsxq login in the opened browser (scan QR code or enter credentials) before the command times out.
  2. Re-run the login command and finish the interactive step promptly.
  3. Persist the browser profile so a previously completed login is reused and polling succeeds immediately.
  4. Verify the page stays on a zsxq.com origin during login; redirect loss breaks the loggedIn probe.

Example fix

// before
const identity = await verifyZsxqIdentity(page); // assumes logged in
// after
await waitForZsxqLogin(page); // interactive login flow, throws if not completed
const identity = await verifyZsxqIdentity(page);
Defensive patterns

Strategy: try-catch

Validate before calling

const r = await page.request.get('https://api.zsxq.com/v2/users/self');
const d = await r.json().catch(() => null);
if (!d?.resp_data?.user) await runInteractiveZsxqLogin(page);

Type guard

const isWaitingForLogin = (e) => (e?.message || '').includes('Waiting for zsxq login');

Try / catch

try {
  await waitForZsxqLogin(page);
} catch (e) {
  if (isWaitingForLogin(e)) {
    // prompt the human user to complete login, then re-run
    await notifyUserToScanQr();
    return waitForZsxqLogin(page);
  }
  throw e;
}

Prevention

When it happens

Trigger: Running the zsxq login command and not completing the login (QR scan / credentials) before the polling deadline; the page redirected away from zsxq.com; login page failed silently.

Common situations: Automated runs with no human available to scan the QR code; slow network causing login to complete after timeout; user closed the login tab mid-flow.

Related errors


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

Appendix: source

Thrown at clis/zsxq/auth.js:64

registerSiteAuthCommands({
  site: 'zsxq',
  domain: 'zsxq.com',
  loginUrl: 'https://wx.zsxq.com/login',
  columns: ['user_id', 'name'],
  verify: verifyZsxqIdentity,
  // No-navigation poll: probe the API from the current page so the login-page
  // QR code isn't reset by a goto on every interval.
  poll: async (page) => {
    const loggedIn = await page.evaluate(`(async () => {
      try {
        const r = await fetch('https://api.zsxq.com/v2/users/self', { credentials: 'include', headers: { Accept: 'application/json' } });
        if (!r.ok) return false;
        const d = await r.json();
        return !!(d?.resp_data?.user);
      } catch { return false; }
    })()`);
    if (!loggedIn) {
      throw new AuthRequiredError('zsxq.com', 'Waiting for zsxq login');
    }
    return verifyZsxqIdentity(page);
  },
});

View on GitHub (pinned to 49907e53dc)