jackwener/OpenCLI · info · AuthRequiredError

Waiting for WeRead wr_vid cookie

Error message

Waiting for WeRead wr_vid cookie

What it means

The poll callback registered in clis/weread/auth.js throws AuthRequiredError('weread.qq.com', 'Waiting for WeRead wr_vid cookie') while the CLI is waiting for the user to complete browser login: the wr_vid session cookie has not yet appeared for https://weread.qq.com. This is an expected transient state during the interactive login flow, signaling 'keep waiting, not logged in yet'.

Source

Thrown at clis/weread/auth.js:55

    }
  })()`);
  if (result?.kind === 'auth') throw new AuthRequiredError('weread.qq.com', result.detail);
  if (result?.kind === 'http') throw new CommandExecutionError(`HTTP ${result.httpStatus} from /web/user`);
  if (result?.kind === 'exception') throw new CommandExecutionError(`WeRead whoami failed: ${result.detail}`);
  if (!result?.ok) throw new CommandExecutionError(`Unexpected WeRead probe: ${JSON.stringify(result)}`);
  return { user_id: result.user_id, name: result.name };
}

registerSiteAuthCommands({
  site: 'weread',
  domain: 'weread.qq.com',
  loginUrl: 'https://weread.qq.com/',
  columns: ['user_id', 'name'],
  quickCheck: hasWereadSessionCookie,
  verify: verifyWereadIdentity,
  poll: async (page) => {
    if (!await hasWereadSessionCookie(page)) {
      throw new AuthRequiredError('weread.qq.com', 'Waiting for WeRead wr_vid cookie');
    }
    return verifyWereadIdentity(page);
  },
});

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Complete the login in the opened browser window at https://weread.qq.com/ (scan QR / WeChat authorize) — the poll will then succeed.
  2. If no browser window opened, unblock popups or run the login command again.
  3. Wait — this error during login polling is normal and not actionable until you finish authentication.
  4. If it never resolves, check that wr_vid gets set after login (DevTools > Application > Cookies); if not, clear cookies and log in fresh.

Example fix

// before: ignoring the login flow
$ opencli weread login   # Waiting for WeRead wr_vid cookie ...
// after: complete the QR/WeChat login in the opened browser; poll then returns the verified identity
Defensive patterns

Strategy: retry

Validate before calling

const cookies = await page.getCookies({ url: 'https://weread.qq.com' });
if (cookies.some(c => c.name === 'wr_vid' && c.value)) console.log('Login detected — safe to proceed.');

Try / catch

try { return await poll(page); } catch (e) {
  if (e instanceof AuthRequiredError && /Waiting for WeRead wr_vid/.test(e.message)) {
    console.log('Still waiting for you to finish login in the browser...');
  } else throw e;
}

Prevention

When it happens

Trigger: During `weread login`, the poller repeatedly calls hasWereadSessionCookie(page); every check before the user logs in (or before WeRead sets wr_vid) throws this AuthRequiredError so the loop keeps polling until the cookie appears.

Common situations: User has not yet scanned the WeChat QR code or completed login in the opened browser; login page loading slowly; user logged into the wrong account or closed the browser before finishing; popup blocked so the login page never opened.

Related errors


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