{"record":{"id":"670867132d7a4742","repo":"jackwener/OpenCLI","slug":"waiting-for-xianyu-unb-tracknick-cookie","errorCode":null,"errorMessage":"Waiting for Xianyu unb/tracknick cookie","messagePattern":"Waiting for Xianyu unb/tracknick cookie","errorType":"error_code","errorClass":"AuthRequiredError","httpStatus":null,"severity":"warning","filePath":"clis/xianyu/auth.js","lineNumber":64,"sourceCode":"    }\n  }\n  const nickname = probe.domNick || decodedTracknick;\n  if (!userId && !nickname) {\n    throw new CommandExecutionError('Xianyu /personal rendered but no user identity extractable — stale unb or layout drift');\n  }\n  return { user_id: String(userId), nickname: String(nickname) };\n}\n\nregisterSiteAuthCommands({\n  site: 'xianyu',\n  domain: 'goofish.com',\n  loginUrl: 'https://www.goofish.com/login',\n  columns: ['user_id', 'nickname'],\n  quickCheck: hasXianyuIdentityCookie,\n  verify: verifyXianyuIdentity,\n  poll: async (page) => {\n    if (!await hasXianyuIdentityCookie(page)) {\n      throw new AuthRequiredError('goofish.com', 'Waiting for Xianyu unb/tracknick cookie');\n    }\n    return verifyXianyuIdentity(page);\n  },\n});\n","sourceCodeStart":46,"sourceCodeEnd":69,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/xianyu/auth.js#L46-L69","documentation":"During login polling, the poll callback checks for the unb/tracknick identity cookies before verifying; if hasXianyuIdentityCookie(page) is false, it throws AuthRequiredError to signal the login is not yet complete and polling should continue.","triggerScenarios":"Polling after the user opens the goofish.com login URL; the browser has not yet received the unb and tracknick cookies because login is still in progress.","commonSituations":"User has not finished logging in yet (QR scan or password step pending); cookies blocked by browser settings; wrong login flow used that never sets these cookies.","solutions":["Wait and keep polling — this is expected until login completes","Complete the login in the automated browser (scan QR / enter credentials)","Verify cookies are not blocked and the profile persists them","If it never appears, confirm the login URL and flow actually set unb/tracknick"],"exampleFix":"// before\nconst identity = await poll(page); // throws until cookies set\n// after\ntry {\n  const identity = await poll(page);\n} catch (e) {\n  if (e instanceof AuthRequiredError) {\n    await waitForLoginCompletion(page); // keep polling with backoff\n  } else throw e;\n}","handlingStrategy":"retry","validationCode":"const hasCookies = await hasXianyuIdentityCookie(page);\nif (!hasCookies) await waitFor(() => hasXianyuIdentityCookie(page), { timeoutMs: 120000 });","typeGuard":null,"tryCatchPattern":"try {\n  return await poll(page);\n} catch (e) {\n  if (e?.name === 'AuthRequiredError') {\n    await sleep(2000);\n    return poll(page); // expected until login completes\n  }\n  throw e;\n}","preventionTips":["Treat this as a normal polling signal, not a fatal failure","Bound polling with a timeout and prompt the user if exceeded","Ensure the browser allows cookies for goofish.com"],"tags":["auth","xianyu","polling","cookies"],"backgroundTag":"auth-session-required","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}