jackwener/OpenCLI · error · CommandExecutionError

Xianyu reply did not observe the sent message: ${sent?.reaso

Error message

Xianyu reply did not observe the sent message: ${sent?.reason || 'unknown-reason'}

What it means

Reply sent the message via buildSendMessageEvaluate(text), but the injected script returned ok:false, meaning it could not verify the outgoing message appeared in the chat. The message may have partially sent or the DOM verification failed. Thrown as CommandExecutionError with the script's reason at clis/xianyu/reply.js:60-62.

Source

Thrown at clis/xianyu/reply.js:61

            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)), 'reply rank click');
            await page.wait(2);
        }
        const state = requireEvaluateObject(await page.evaluate(buildExtractChatStateEvaluate()), 'reply');
        if (state?.requiresAuth) {
            throw new AuthRequiredError('www.goofish.com', 'Xianyu reply requires a logged-in browser session');
        }
        if (!state?.can_input) {
            throw selectorError('闲鱼聊天输入框', '未找到可用的聊天输入框,请确认该会话页已正确加载');
        }
        const sent = requireEvaluateObject(await page.evaluate(buildSendMessageEvaluate(text)), 'reply send');
        if (!sent?.ok) {
            throw new CommandExecutionError(`Xianyu reply did not observe the sent message: ${sent?.reason || 'unknown-reason'}`);
        }
        await page.wait(1);
        return [{
            status: 'sent',
            peer_name: state.peer_name || '',
            item_title: state.item_title || '',
            price: state.price || '',
            location: state.location || '',
            message: text,
            peer_user_id: userId,
            item_id: itemId,
            url: url || '',
            item_url: state.item_url || '',
        }];
    },
});

export const __test__ = {

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Read `reason` from the message; if it indicates send-click failure, retry the command — sends are frequently transient failures.
  2. Simplify the message text (remove links/sensitive keywords that goofish may filter).
  3. Verify manually at www.goofish.com/im whether the message actually landed before re-sending, to avoid duplicates.
  4. If the DOM changed, update buildSendMessageEvaluate's send/verification selectors.

Example fix

// before: single attempt
const sent = await page.evaluate(buildSendMessageEvaluate(text));
// after: retry once on verification failure
let sent = await page.evaluate(buildSendMessageEvaluate(text));
if (!sent?.ok) { await page.wait(2); sent = await page.evaluate(buildSendMessageEvaluate(text)); }
Defensive patterns

Strategy: try-catch

Try / catch

try {
  return await reply(kwargs);
} catch (e) {
  if (String(e.message).includes('did not observe the sent message')) {
    // check the conversation manually before resending to avoid duplicates
    const delivered = await checkLastMessage(kwargs);
    if (!delivered) return reply(kwargs); // single retry for transient send failures
  }
  throw e;
}

Prevention

When it happens

Trigger: `xianyu reply` where the send evaluate returns {ok:false, reason}: input box filled but send click failed, message blocked/filtered by goofish, chat DOM re-rendered mid-send, or the sent-bubble selector changed so verification never matched.

Common situations: Goofish anti-spam silently dropping messages with links or banned keywords; network flakiness during send; front-end update changing the message-list DOM that the verifier checks; conversation window closed by the peer session refreshing.

Related errors


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