{"record":{"id":"1a9bd07d0425a3e9","repo":"jackwener/OpenCLI","slug":"xianyu-inbox-requires-a-logged-in-browser-session","errorCode":null,"errorMessage":"Xianyu inbox requires a logged-in browser session","messagePattern":"Xianyu inbox requires a logged-in browser session","errorType":"error_code","errorClass":"AuthRequiredError","httpStatus":null,"severity":"error","filePath":"clis/xianyu/inbox.js","lineNumber":48,"sourceCode":"    func: async (page, kwargs) => {\n        const limit = normalizeLimit(kwargs.limit, DEFAULT_INBOX_LIMIT, MAX_INBOX_LIMIT, 'inbox --limit');\n        const unreadOnly = Boolean(kwargs['unread-only']);\n        const resolveIds = Boolean(kwargs['resolve-ids']);\n        let currentUrl = '';\n        if (page.getCurrentUrl) {\n            try {\n                currentUrl = await page.getCurrentUrl();\n            } catch {\n                currentUrl = '';\n            }\n        }\n        if (!/https:\\/\\/www\\.goofish\\.com\\/im\\b/.test(currentUrl)) {\n            await page.goto(buildInboxUrl());\n        }\n        await page.wait(4);\n        const payload = requireEvaluateObject(await page.evaluate(buildExtractInboxEvaluate(limit)), 'inbox');\n        if (payload?.requiresAuth) {\n            throw new AuthRequiredError('www.goofish.com', 'Xianyu inbox requires a logged-in browser session');\n        }\n        if (payload?.blocked) {\n            throw new AuthRequiredError('www.goofish.com', 'Xianyu inbox is blocked by verification or risk control');\n        }\n        if (!Array.isArray(payload.items)) {\n            throw new CommandExecutionError('Xianyu inbox returned malformed conversation list');\n        }\n        const items = payload.items;\n        if (!items.length) {\n            throw new EmptyResultError('xianyu inbox', 'No Xianyu inbox conversations were found');\n        }\n        let conversations = items.slice(0, limit);\n        if (unreadOnly) {\n            conversations = conversations.filter((item) => Boolean(item.unread));\n        }\n        if (resolveIds) {\n            for (const item of conversations) {\n                if (item.item_id && item.peer_user_id) continue;","sourceCodeStart":30,"sourceCodeEnd":66,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/xianyu/inbox.js#L30-L66","documentation":"An AuthRequiredError thrown by the xianyu inbox command when the injected page script detects login-prompt text (请先登录 / 登录后 variants) in the rendered body of www.goofish.com/im. The library scrapes the goofish IM page with your logged-in browser cookies; without a valid session the site shows a login wall instead of the conversation list, so the command refuses to proceed.","triggerScenarios":"Running 'xianyu inbox' (any variant) while the browser session/cookie profile for www.goofish.com is logged out, the session cookie expired, or cookies were cleared — the page body contains the login prompt text detected by requiresAuth.","commonSituations":"Cookie jar expired after weeks of inactivity; user logged out in the shared browser profile; COOKIE strategy CLI pointed at a fresh/empty browser profile; goofish invalidated the session server-side (password change, risk control logout).","solutions":["Open www.goofish.com in the automation browser and log in manually to refresh cookies","Re-import/copy a fresh logged-in cookie jar into the profile used by the CLI","Verify the browser profile path configured for the CLI is the one you actually logged into","If login appears valid but the text still matches, re-run once — the page may have rendered the login wall transiently before hydration"],"exampleFix":"// before (failing because cookies expired)\nawait page.goto(buildInboxUrl()); // body contains 请先登录\n// after (refresh session first)\nawait page.goto('https://www.goofish.com/');\n// log in / restore cookies, confirm logged in, then:\nawait page.goto(buildInboxUrl());","handlingStrategy":"try-catch","validationCode":"null","typeGuard":"null","tryCatchPattern":"import { AuthRequiredError } from '@jackwener/opencli/errors';\ntry {\n  const convos = await runInbox();\n} catch (e) {\n  if (e instanceof AuthRequiredError && /logged-in/.test(e.message)) {\n    // prompt user to log in at https://www.goofish.com and refresh cookies\n  } else throw e;\n}","preventionTips":["Periodically refresh goofish.com cookies before they expire","Confirm you're logged into the same browser profile the CLI uses","Check login state with a lightweight page visit before scheduled inbox jobs","Never share one cookie profile across many concurrent jobs"],"tags":["auth","cookies","session-expired","scraping"],"backgroundTag":"login-required","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}