jackwener/OpenCLI · warning · EmptyResultError

No visible messages were found in this Xianyu conversation

Error message

No visible messages were found in this Xianyu conversation

What it means

The chat page was reached and a well-formed state extracted, but the messages array is empty, so EmptyResultError('xianyu messages', 'No visible messages were found in this Xianyu conversation') is thrown at clis/xianyu/messages.js:72. The library treats a zero-length visible message list as a legitimate empty outcome (e.g. a new/empty conversation) rather than a failure of extraction.

Source

Thrown at clis/xianyu/messages.js:72

            if (!page.getCurrentUrl || !/https:\/\/www\.goofish\.com\/im\b/.test(await page.getCurrentUrl())) {
                await page.goto('https://www.goofish.com/im');
            }
        }
        await page.wait(2);
        if (rank > 0) {
            requireClickResult(await page.evaluate(buildClickInboxConversationEvaluate(rank - 1)), 'messages rank click');
            await page.wait(2);
        }
        const state = requireEvaluateObject(await page.evaluate(buildExtractChatStateEvaluate(limit)), 'messages');
        if (state?.requiresAuth) {
            throw new AuthRequiredError('www.goofish.com', 'Xianyu messages requires a logged-in browser session');
        }
        if (!Array.isArray(state.messages)) {
            throw new CommandExecutionError('Xianyu messages returned malformed message list');
        }
        const messages = state.messages;
        if (!messages.length) {
            throw new EmptyResultError('xianyu messages', 'No visible messages were found in this Xianyu conversation');
        }
        return messages.slice(-limit).map((message, index) => ({
            index: index + 1,
            peer_name: state.peer_name || '',
            item_title: state.item_title || '',
            message: message.text || '',
            item_id: itemId,
            peer_user_id: userId,
            url: url || '',
        }));
    },
});

export const __test__ = {
    buildChatUrl,
    buildExtractChatStateEvaluate,
    normalizeLimit,
    normalizeRank,

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Confirm the conversation actually has messages by checking it manually in the browser.
  2. Re-run with a slightly longer wait so lazy-loaded messages render before extraction.
  3. Use item_id/user_id from a known active conversation instead of a possibly stale rank.
  4. Catch EmptyResultError and treat it as 'no messages yet' in polling/sync workflows instead of failing.
  5. Refresh the inbox listing — the conversation may have been deleted.

Example fix

// before
cli.run(['xianyu', 'messages', '--rank', '3']); // crashes on empty chat

// after
try {
  await cli.run(['xianyu', 'messages', '--rank', '3']);
} catch (e) {
  if (e instanceof EmptyResultError) return []; // no messages yet
  throw e;
}
Defensive patterns

Strategy: fallback

Try / catch

try {
  return await cli.run(['xianyu', 'messages', '--rank', String(rank)]);
} catch (e) {
  if (e instanceof EmptyResultError && /No visible messages/.test(e.message)) return []; // empty conversation
  throw e;
}

Prevention

When it happens

Trigger: Targeting a conversation that genuinely has no visible messages (brand-new chat, all messages unloaded/hidden), or a chat page whose message list has not rendered when extraction runs (no message nodes in DOM yet).

Common situations: Pointing at an item/user pair that never exchanged messages; selecting an inbox rank for a system/empty conversation; extremely fast extraction before lazy-loaded messages appear; deleted conversation remnants still listed in inbox.

Related errors


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