{"record":{"id":"f034266689647292","repo":"jackwener/OpenCLI","slug":"waiting-for-zsxq-login","errorCode":null,"errorMessage":"Waiting for zsxq login","messagePattern":"Waiting for zsxq login","errorType":"error_code","errorClass":"AuthRequiredError","httpStatus":null,"severity":"error","filePath":"clis/zsxq/auth.js","lineNumber":64,"sourceCode":"registerSiteAuthCommands({\n  site: 'zsxq',\n  domain: 'zsxq.com',\n  loginUrl: 'https://wx.zsxq.com/login',\n  columns: ['user_id', 'name'],\n  verify: verifyZsxqIdentity,\n  // No-navigation poll: probe the API from the current page so the login-page\n  // QR code isn't reset by a goto on every interval.\n  poll: async (page) => {\n    const loggedIn = await page.evaluate(`(async () => {\n      try {\n        const r = await fetch('https://api.zsxq.com/v2/users/self', { credentials: 'include', headers: { Accept: 'application/json' } });\n        if (!r.ok) return false;\n        const d = await r.json();\n        return !!(d?.resp_data?.user);\n      } catch { return false; }\n    })()`);\n    if (!loggedIn) {\n      throw new AuthRequiredError('zsxq.com', 'Waiting for zsxq login');\n    }\n    return verifyZsxqIdentity(page);\n  },\n});\n","sourceCodeStart":46,"sourceCodeEnd":69,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/zsxq/auth.js#L46-L69","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Complete the zsxq login in the opened browser (scan QR code or enter credentials) before the command times out.","Re-run the login command and finish the interactive step promptly.","Persist the browser profile so a previously completed login is reused and polling succeeds immediately.","Verify the page stays on a zsxq.com origin during login; redirect loss breaks the loggedIn probe."],"exampleFix":"// before\nconst identity = await verifyZsxqIdentity(page); // assumes logged in\n// after\nawait waitForZsxqLogin(page); // interactive login flow, throws if not completed\nconst identity = await verifyZsxqIdentity(page);","handlingStrategy":"try-catch","validationCode":"const r = await page.request.get('https://api.zsxq.com/v2/users/self');\nconst d = await r.json().catch(() => null);\nif (!d?.resp_data?.user) await runInteractiveZsxqLogin(page);","typeGuard":"const isWaitingForLogin = (e) => (e?.message || '').includes('Waiting for zsxq login');","tryCatchPattern":"try {\n  await waitForZsxqLogin(page);\n} catch (e) {\n  if (isWaitingForLogin(e)) {\n    // prompt the human user to complete login, then re-run\n    await notifyUserToScanQr();\n    return waitForZsxqLogin(page);\n  }\n  throw e;\n}","preventionTips":["Always run the login command in headed mode when a human is available to scan the QR code.","Use a persistent profile so subsequent runs skip the login step.","Schedule automation only after a verified successful login."],"tags":["auth","login","timeout"],"backgroundTag":"login-not-completed","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}