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
- Confirm the conversation actually has messages by checking it manually in the browser.
- Re-run with a slightly longer wait so lazy-loaded messages render before extraction.
- Use item_id/user_id from a known active conversation instead of a possibly stale rank.
- Catch EmptyResultError and treat it as 'no messages yet' in polling/sync workflows instead of failing.
- 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
- Allow a short extra wait for lazy-loaded messages before judging a chat empty.
- Prefer explicit item_id/user_id targeting over possibly stale inbox ranks.
- In polling workflows, treat EmptyResultError as 'no new messages', not failure.
- Refresh inbox listings periodically to drop deleted conversations.
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
- No Xianyu inbox conversations were found
- 闲鱼商品详情接口未返回有效数据
- errorMessage || `Xianyu item detail request failed: ${result
- No item detail was returned for the specified item_id
- zhihu download
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/4011ea0bcdd37606.
Report an issue: GitHub.