{"record":{"id":"1889a0dfa91b552d","repo":"jackwener/OpenCLI","slug":"waiting-for-nowcoder-login","errorCode":null,"errorMessage":"Waiting for Nowcoder login","messagePattern":"Waiting for Nowcoder login","errorType":"exception","errorClass":"AuthRequiredError","httpStatus":null,"severity":"warning","filePath":"clis/nowcoder/auth.js","lineNumber":61,"sourceCode":"  await page.goto('https://www.nowcoder.com/');\n  await page.wait(2);\n  const probe = await page.evaluate(WHOAMI_PROBE);\n  if (probe?.kind === 'auth') throw new AuthRequiredError('nowcoder.com', probe.detail);\n  if (probe?.kind === 'http') throw new CommandExecutionError(`HTTP ${probe.httpStatus} from nowcoder profile API`);\n  if (probe?.kind === 'exception') throw new CommandExecutionError(`Nowcoder whoami failed: ${probe.detail}`);\n  if (!probe?.ok) throw new CommandExecutionError(`Unexpected nowcoder probe: ${JSON.stringify(probe)}`);\n  return { user_id: probe.user_id, nickname: probe.nickname };\n}\n\nregisterSiteAuthCommands({\n  site: 'nowcoder',\n  domain: 'nowcoder.com',\n  loginUrl: 'https://www.nowcoder.com/login',\n  columns: ['user_id', 'nickname'],\n  verify: verifyNowcoderIdentity,\n  poll: async (page) => {\n    if (!await hasNowcoderSessionCookie(page)) {\n      throw new AuthRequiredError('nowcoder.com', 'Waiting for Nowcoder login');\n    }\n    return verifyNowcoderIdentity(page);\n  },\n});\n","sourceCodeStart":43,"sourceCodeEnd":66,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/nowcoder/auth.js#L43-L66","documentation":"During the login flow, the poll callback checks for the `t` session cookie; while it is absent it throws AuthRequiredError('Waiting for Nowcoder login') to signal the watcher to keep waiting rather than verifying. This is the normal 'not yet logged in' signal during interactive login, not a hard failure of verification.","triggerScenarios":"User hasn't completed the login at https://www.nowcoder.com/login yet while the CLI is polling; login succeeded but cookies are set on a different domain/subdomain than checked; cookies blocked or cleared during the login session.","commonSituations":"User abandoned or is slow completing login; logging into a different browser profile than the one polled; privacy settings/cookie blocking preventing `t` from being stored.","solutions":["Complete the login in the opened browser window/tab","Confirm login landed in the same browser profile the CLI polls (check cookie store)","If finished but still failing, manually verify the `t` cookie exists for https://www.nowcoder.com and restart the command","Disable cookie-blocking extensions/private mode for the login session"],"exampleFix":"// before\nawait startNowcoderLogin();\nawait verifyNowcoderIdentity(page);\n// after\nawait startNowcoderLogin();\nfor (let i = 0; i < 60; i++) {\n  const cookies = await page.getCookies({ url: 'https://www.nowcoder.com' });\n  if (cookies.some(c => c.name === 't' && c.value)) return verifyNowcoderIdentity(page);\n  await new Promise(r => setTimeout(r, 2000));\n}\nthrow new AuthRequiredError('nowcoder.com', 'Waiting for Nowcoder login');","handlingStrategy":"retry","validationCode":"const cookies = await page.getCookies({ url: 'https://www.nowcoder.com' });\nconst ready = cookies.some(c => c.name === 't' && c.value);\nif (!ready) {\n  // prompt the user to finish login at https://www.nowcoder.com/login\n  await waitForUserLogin();\n}","typeGuard":"function loginCompleted(cookies) {\n  return cookies.some(c => c.name === 't' && c.value.length > 0);\n}","tryCatchPattern":"try {\n  await waitForNowcoderLogin(page);\n} catch (e) {\n  if (e instanceof AuthRequiredError && /Waiting for Nowcoder login/.test(e.message)) {\n    console.log('Complete the login in the browser, then re-run.');\n    return waitForNowcoderLogin(page);\n  }\n  throw e;\n}","preventionTips":["Complete the login promptly in the opened browser window","Use the same browser profile for login and verification","Avoid private/incognito mode or cookie-blocking extensions during login","Verify the `t` cookie appears after login before re-running commands"],"tags":["auth","login-flow","polling","cookies","nowcoder"],"backgroundTag":"login-pending","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}