{"record":{"id":"4011ea0bcdd37606","repo":"jackwener/OpenCLI","slug":"no-visible-messages-were-found-in-this-xianyu-conv","errorCode":null,"errorMessage":"No visible messages were found in this Xianyu conversation","messagePattern":"No visible messages were found in this Xianyu conversation","errorType":"exception","errorClass":"EmptyResultError","httpStatus":null,"severity":"warning","filePath":"clis/xianyu/messages.js","lineNumber":72,"sourceCode":"            if (!page.getCurrentUrl || !/https:\\/\\/www\\.goofish\\.com\\/im\\b/.test(await page.getCurrentUrl())) {\n                await page.goto('https://www.goofish.com/im');\n            }\n        }\n        await page.wait(2);\n        if (rank > 0) {\n            requireClickResult(await page.evaluate(buildClickInboxConversationEvaluate(rank - 1)), 'messages rank click');\n            await page.wait(2);\n        }\n        const state = requireEvaluateObject(await page.evaluate(buildExtractChatStateEvaluate(limit)), 'messages');\n        if (state?.requiresAuth) {\n            throw new AuthRequiredError('www.goofish.com', 'Xianyu messages requires a logged-in browser session');\n        }\n        if (!Array.isArray(state.messages)) {\n            throw new CommandExecutionError('Xianyu messages returned malformed message list');\n        }\n        const messages = state.messages;\n        if (!messages.length) {\n            throw new EmptyResultError('xianyu messages', 'No visible messages were found in this Xianyu conversation');\n        }\n        return messages.slice(-limit).map((message, index) => ({\n            index: index + 1,\n            peer_name: state.peer_name || '',\n            item_title: state.item_title || '',\n            message: message.text || '',\n            item_id: itemId,\n            peer_user_id: userId,\n            url: url || '',\n        }));\n    },\n});\n\nexport const __test__ = {\n    buildChatUrl,\n    buildExtractChatStateEvaluate,\n    normalizeLimit,\n    normalizeRank,","sourceCodeStart":54,"sourceCodeEnd":90,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/xianyu/messages.js#L54-L90","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","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."],"exampleFix":"// before\ncli.run(['xianyu', 'messages', '--rank', '3']); // crashes on empty chat\n\n// after\ntry {\n  await cli.run(['xianyu', 'messages', '--rank', '3']);\n} catch (e) {\n  if (e instanceof EmptyResultError) return []; // no messages yet\n  throw e;\n}","handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  return await cli.run(['xianyu', 'messages', '--rank', String(rank)]);\n} catch (e) {\n  if (e instanceof EmptyResultError && /No visible messages/.test(e.message)) return []; // empty conversation\n  throw e;\n}","preventionTips":["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."],"tags":["empty-result","xianyu","lazy-loading"],"backgroundTag":"empty-response-payload","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}