{"record":{"id":"a9f440a030e462f6","repo":"jackwener/OpenCLI","slug":"xianyu-inbox-returned-malformed-conversation-list","errorCode":null,"errorMessage":"Xianyu inbox returned malformed conversation list","messagePattern":"Xianyu inbox returned malformed conversation list","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/xianyu/inbox.js","lineNumber":54,"sourceCode":"            try {\n                currentUrl = await page.getCurrentUrl();\n            } catch {\n                currentUrl = '';\n            }\n        }\n        if (!/https:\\/\\/www\\.goofish\\.com\\/im\\b/.test(currentUrl)) {\n            await page.goto(buildInboxUrl());\n        }\n        await page.wait(4);\n        const payload = requireEvaluateObject(await page.evaluate(buildExtractInboxEvaluate(limit)), 'inbox');\n        if (payload?.requiresAuth) {\n            throw new AuthRequiredError('www.goofish.com', 'Xianyu inbox requires a logged-in browser session');\n        }\n        if (payload?.blocked) {\n            throw new AuthRequiredError('www.goofish.com', 'Xianyu inbox is blocked by verification or risk control');\n        }\n        if (!Array.isArray(payload.items)) {\n            throw new CommandExecutionError('Xianyu inbox returned malformed conversation list');\n        }\n        const items = payload.items;\n        if (!items.length) {\n            throw new EmptyResultError('xianyu inbox', 'No Xianyu inbox conversations were found');\n        }\n        let conversations = items.slice(0, limit);\n        if (unreadOnly) {\n            conversations = conversations.filter((item) => Boolean(item.unread));\n        }\n        if (resolveIds) {\n            for (const item of conversations) {\n                if (item.item_id && item.peer_user_id) continue;\n                const rowIndex = Number(item.row_index);\n                if (!Number.isInteger(rowIndex) || rowIndex < 0) continue;\n                requireClickResult(await page.evaluate(buildClickInboxConversationEvaluate(rowIndex)), 'inbox resolve-ids click');\n                await page.wait(1);\n                const current = requireEvaluateObject(await page.evaluate(buildReadCurrentConversationUrlEvaluate()), 'inbox current-url');\n                item.item_id = current?.item_id || item.item_id || '';","sourceCodeStart":36,"sourceCodeEnd":72,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/xianyu/inbox.js#L36-L72","documentation":"A CommandExecutionError thrown when the inbox evaluate payload passed the auth/blocked checks but payload.items is not an array. This means the page script returned an unexpected shape — normally impossible when the script runs intact, so it usually indicates the evaluate result was altered, truncated, or the page DOM environment produced a non-standard return.","triggerScenarios":"page.evaluate returning an object without an items array — e.g. a driver serializing the result differently, a proxy/interceptor mangling the result, or a modified/older build of the evaluate script returning a legacy shape.","commonSituations":"Automation-driver version mismatch that drops fields during JSON serialization; running a patched/older copy of im.js whose script returns an object without items; the page context replaced mid-evaluate so an unexpected object came back.","solutions":["Update the library/driver so the evaluate script and serialization match","Re-run the command — a mid-evaluate navigation can produce a one-off bad payload","Verify no local patches to buildExtractInboxEvaluate changed the return shape ({requiresAuth, blocked, items})","If it persists, log the raw payload from page.evaluate before requireEvaluateObject to inspect the actual shape"],"exampleFix":"// before\nconst payload = requireEvaluateObject(await page.evaluate(buildExtractInboxEvaluate(limit)), 'inbox');\n// after\nconst payload = requireEvaluateObject(await page.evaluate(buildExtractInboxEvaluate(limit)), 'inbox');\nif (!Array.isArray(payload.items)) {\n  await page.wait(2);\n  payload = requireEvaluateObject(await page.evaluate(buildExtractInboxEvaluate(limit)), 'inbox'); // retry once\n}","handlingStrategy":"validation","validationCode":"function hasItemsArray(payload) {\n  return payload !== null && typeof payload === 'object' && Array.isArray(payload.items);\n}\n// if (!hasItemsArray(payload)) re-run the evaluate before proceeding;","typeGuard":"function isInboxPayload(p) {\n  return p !== null && typeof p === 'object' && !Array.isArray(p)\n    && typeof p.requiresAuth === 'boolean'\n    && typeof p.blocked === 'boolean'\n    && Array.isArray(p.items);\n}","tryCatchPattern":"try {\n  const convos = await runInbox();\n} catch (e) {\n  if (String(e).includes('malformed conversation list')) {\n    // retry once; if persistent, update library/driver versions\n  } else throw e;\n}","preventionTips":["Keep the library and automation driver versions in sync","Don't patch buildExtractInboxEvaluate locally; its return contract is {requiresAuth, blocked, items}","Log the raw evaluate payload when this error occurs to diagnose serialization drift","Retry transiently — mid-evaluate navigation is the most common benign cause"],"tags":["payload-validation","browser-automation","schema-mismatch"],"backgroundTag":"schema-validation-failed","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}