{"record":{"id":"52cf2ea7face634e","repo":"jackwener/OpenCLI","slug":"waiting-for-weread-wr-vid-cookie","errorCode":null,"errorMessage":"Waiting for WeRead wr_vid cookie","messagePattern":"Waiting for WeRead wr_vid cookie","errorType":"exception","errorClass":"AuthRequiredError","httpStatus":null,"severity":"info","filePath":"clis/weread/auth.js","lineNumber":55,"sourceCode":"    }\n  })()`);\n  if (result?.kind === 'auth') throw new AuthRequiredError('weread.qq.com', result.detail);\n  if (result?.kind === 'http') throw new CommandExecutionError(`HTTP ${result.httpStatus} from /web/user`);\n  if (result?.kind === 'exception') throw new CommandExecutionError(`WeRead whoami failed: ${result.detail}`);\n  if (!result?.ok) throw new CommandExecutionError(`Unexpected WeRead probe: ${JSON.stringify(result)}`);\n  return { user_id: result.user_id, name: result.name };\n}\n\nregisterSiteAuthCommands({\n  site: 'weread',\n  domain: 'weread.qq.com',\n  loginUrl: 'https://weread.qq.com/',\n  columns: ['user_id', 'name'],\n  quickCheck: hasWereadSessionCookie,\n  verify: verifyWereadIdentity,\n  poll: async (page) => {\n    if (!await hasWereadSessionCookie(page)) {\n      throw new AuthRequiredError('weread.qq.com', 'Waiting for WeRead wr_vid cookie');\n    }\n    return verifyWereadIdentity(page);\n  },\n});\n","sourceCodeStart":37,"sourceCodeEnd":60,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/weread/auth.js#L37-L60","documentation":"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'.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Complete the login in the opened browser window at https://weread.qq.com/ (scan QR / WeChat authorize) — the poll will then succeed.","If no browser window opened, unblock popups or run the login command again.","Wait — this error during login polling is normal and not actionable until you finish authentication.","If it never resolves, check that wr_vid gets set after login (DevTools > Application > Cookies); if not, clear cookies and log in fresh."],"exampleFix":"// before: ignoring the login flow\n$ opencli weread login   # Waiting for WeRead wr_vid cookie ...\n// after: complete the QR/WeChat login in the opened browser; poll then returns the verified identity","handlingStrategy":"retry","validationCode":"const cookies = await page.getCookies({ url: 'https://weread.qq.com' });\nif (cookies.some(c => c.name === 'wr_vid' && c.value)) console.log('Login detected — safe to proceed.');","typeGuard":null,"tryCatchPattern":"try { return await poll(page); } catch (e) {\n  if (e instanceof AuthRequiredError && /Waiting for WeRead wr_vid/.test(e.message)) {\n    console.log('Still waiting for you to finish login in the browser...');\n  } else throw e;\n}","preventionTips":["Complete the QR/WeChat login promptly in the opened browser","Don't close the browser window during login polling","Unblock popups so the login page can open","Verify wr_vid appears in cookies after login to confirm success"],"tags":["auth","login","polling","weread"],"backgroundTag":"waiting-for-login","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}