jackwener/OpenCLI · error · CommandExecutionError

Xianyu inbox returned malformed conversation list

Error message

Xianyu inbox returned malformed conversation list

What it means

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.

Source

Thrown at clis/xianyu/inbox.js:54

            try {
                currentUrl = await page.getCurrentUrl();
            } catch {
                currentUrl = '';
            }
        }
        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 || '';

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Update the library/driver so the evaluate script and serialization match
  2. Re-run the command — a mid-evaluate navigation can produce a one-off bad payload
  3. Verify no local patches to buildExtractInboxEvaluate changed the return shape ({requiresAuth, blocked, items})
  4. If it persists, log the raw payload from page.evaluate before requireEvaluateObject to inspect the actual shape

Example fix

// before
const payload = requireEvaluateObject(await page.evaluate(buildExtractInboxEvaluate(limit)), 'inbox');
// after
const payload = requireEvaluateObject(await page.evaluate(buildExtractInboxEvaluate(limit)), 'inbox');
if (!Array.isArray(payload.items)) {
  await page.wait(2);
  payload = requireEvaluateObject(await page.evaluate(buildExtractInboxEvaluate(limit)), 'inbox'); // retry once
}
Defensive patterns

Strategy: validation

Validate before calling

function hasItemsArray(payload) {
  return payload !== null && typeof payload === 'object' && Array.isArray(payload.items);
}
// if (!hasItemsArray(payload)) re-run the evaluate before proceeding;

Type guard

function isInboxPayload(p) {
  return p !== null && typeof p === 'object' && !Array.isArray(p)
    && typeof p.requiresAuth === 'boolean'
    && typeof p.blocked === 'boolean'
    && Array.isArray(p.items);
}

Try / catch

try {
  const convos = await runInbox();
} catch (e) {
  if (String(e).includes('malformed conversation list')) {
    // retry once; if persistent, update library/driver versions
  } else throw e;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.

Related errors


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