jackwener/OpenCLI · error · AuthRequiredError
Xianyu inbox requires a logged-in browser session
Error message
Xianyu inbox requires a logged-in browser session
What it means
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.
Source
Thrown at clis/xianyu/inbox.js:48
func: async (page, kwargs) => {
const limit = normalizeLimit(kwargs.limit, DEFAULT_INBOX_LIMIT, MAX_INBOX_LIMIT, 'inbox --limit');
const unreadOnly = Boolean(kwargs['unread-only']);
const resolveIds = Boolean(kwargs['resolve-ids']);
let currentUrl = '';
if (page.getCurrentUrl) {
try {
currentUrl = await page.getCurrentUrl();
} catch {
currentUrl = '';
}
}
if (!/https:\/\/www\.goofish\.com\/im\b/.test(currentUrl)) {
await page.goto(buildInboxUrl());
}
await page.wait(4);
const payload = requireEvaluateObject(await page.evaluate(buildExtractInboxEvaluate(limit)), 'inbox');
if (payload?.requiresAuth) {
throw new AuthRequiredError('www.goofish.com', 'Xianyu inbox requires a logged-in browser session');
}
if (payload?.blocked) {
throw new AuthRequiredError('www.goofish.com', 'Xianyu inbox is blocked by verification or risk control');
}
if (!Array.isArray(payload.items)) {
throw new CommandExecutionError('Xianyu inbox returned malformed conversation list');
}
const items = payload.items;
if (!items.length) {
throw new EmptyResultError('xianyu inbox', 'No Xianyu inbox conversations were found');
}
let conversations = items.slice(0, limit);
if (unreadOnly) {
conversations = conversations.filter((item) => Boolean(item.unread));
}
if (resolveIds) {
for (const item of conversations) {
if (item.item_id && item.peer_user_id) continue;View on GitHub (pinned to 49907e53dc)
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
Example fix
// before (failing because cookies expired)
await page.goto(buildInboxUrl()); // body contains 请先登录
// after (refresh session first)
await page.goto('https://www.goofish.com/');
// log in / restore cookies, confirm logged in, then:
await page.goto(buildInboxUrl()); Defensive patterns
Strategy: try-catch
Validate before calling
null
Type guard
null
Try / catch
import { AuthRequiredError } from '@jackwener/opencli/errors';
try {
const convos = await runInbox();
} catch (e) {
if (e instanceof AuthRequiredError && /logged-in/.test(e.message)) {
// prompt user to log in at https://www.goofish.com and refresh cookies
} else throw e;
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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).
Related errors
- Bilibili ${label} API requires login or permission: ${messag
- bilibili.com
- result.detail (auth required from Claude probe)
- auth
- quark.cn
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/1a9bd07d0425a3e9.
Report an issue: GitHub.