jackwener/OpenCLI · info · EmptyResultError

No Xianyu inbox conversations were found

Error message

No Xianyu inbox conversations were found

What it means

The `xianyu inbox` command fetches your Xianyu (闲鱼/Goofish) conversation list and throws EmptyResultError when the API responds successfully but `payload.items` is an empty array — i.e. the account genuinely has no inbox conversations. The library distinguishes this from a malformed payload (which throws CommandExecutionError) so callers can treat 'no data' as a distinct EMPTY_RESULT exit code. The hint defaults to 'The page structure may have changed, or you may need to log in'.

Source

Thrown at clis/xianyu/inbox.js:58

            }
        }
        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;
                const rowIndex = Number(item.row_index);
                if (!Number.isInteger(rowIndex) || rowIndex < 0) continue;
                requireClickResult(await page.evaluate(buildClickInboxConversationEvaluate(rowIndex)), 'inbox resolve-ids click');
                await page.wait(1);
                const current = requireEvaluateObject(await page.evaluate(buildReadCurrentConversationUrlEvaluate()), 'inbox current-url');
                item.item_id = current?.item_id || item.item_id || '';
                item.peer_user_id = current?.peer_user_id || item.peer_user_id || '';
                item.url = current?.url || item.url || '';
            }
        }

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Confirm the logged-in Xianyu account actually has conversations (open the inbox on www.goofish.com in a browser).
  2. If you expected messages on another account, re-authenticate the browser session with the correct account.
  3. Handle the EMPTY_RESULT exit code / error code in scripts as an expected 'no data' branch rather than retrying.
  4. Drop `--limit` assumptions if any, since the error occurs before slicing/filtering — the source list itself is empty.

Example fix

// before
await cli.run(['xianyu', 'inbox']); // crashes with EmptyResultError when items: []
// after
try {
  const inbox = await cli.run(['xianyu', 'inbox']);
} catch (err) {
  if (err.code === 'EMPTY_RESULT') return []; // treat as empty inbox
  throw err;
}
Defensive patterns

Strategy: try-catch

Validate before calling

// No reliable pre-call check; optionally verify account has messages via the web UI.
// Caller-side: treat EMPTY_RESULT as an expected empty branch.
const EMPTY_RESULT = 'EMPTY_RESULT';

Type guard

function isEmptyResultError(err) {
  return err && err.code === 'EMPTY_RESULT';
}

Try / catch

try {
  const inbox = await cli.run(['xianyu', 'inbox']);
  process(inbox);
} catch (err) {
  if (err.code === 'EMPTY_RESULT') {
    return []; // no conversations — expected state, not a failure
  }
  throw err;
}

Prevention

When it happens

Trigger: Running `xianyu inbox` (with any flags) against an account whose mtop conversation API returns `{ items: [] }`. Note: if `--unread-only` filters everything out, this error is NOT thrown here — it fires only when the raw items list itself is empty before filtering.

Common situations: Freshly logged-in or brand-new Xianyu accounts with no buyer/seller messages; a re-registered account whose conversations were cleared; testing against a throwaway account; session cookies pointing at a different account than expected.

Understand the failure class

Background: EmptyResultError / "no results found": when an API or scraper succeeds but returns zero rows — this error's family across 9 libraries.

Related errors


AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29). Data as JSON: /api/errors/73b2df0ea53f677e. Report an issue: GitHub.