jackwener/OpenCLI · error · CommandExecutionError
Send button click failed
Error message
Send button click failed
What it means
Thrown when clickBySvgNameScript('Send') fails to find/click Kimi's Send button. It can mean the button was not found in the DOM at all (message empty or still processing) or it was disabled — the actual reason comes from sendRes.reason, with this string as fallback. CommandExecutionError carries that detail.
Source
Thrown at clis/kimi/chat.js:278
if (!prompt) throw new ArgumentError('text', 'is required');
await ensureOnKimi(page);
const beforeUsers = await page.evaluate(`(() => {
return Array.from(document.querySelectorAll('.chat-content-list .chat-content-item, .message-list > *, .segment'))
.filter((row) => /user|sent-by-user|me-/i.test(String(row.className || ''))).length;
})()`);
const typeRes = await page.evaluate(`(() => {
${IS_VISIBLE_JS}
const editor = document.querySelector('[contenteditable="true"][role="textbox"]');
if (!editor || !isVisible(editor)) return { ok: false, reason: 'Kimi composer not visible.' };
editor.focus();
document.execCommand('selectAll', false);
document.execCommand('insertText', false, ${JSON.stringify(prompt)});
return { ok: true };
})()`);
if (!typeRes?.ok) throw new CommandExecutionError(typeRes?.reason || 'composer type failed', '');
await page.wait(0.3);
const sendRes = await page.evaluate(clickBySvgNameScript('Send'));
if (!sendRes?.ok) throw new CommandExecutionError(sendRes?.reason || 'Send button click failed', '');
const deadline = Date.now() + 3000;
while (Date.now() < deadline) {
const verified = await page.evaluate(`(() => {
const normalize = (value) => String(value || '').replace(/\\u00a0/g, ' ').replace(/\\s+/g, ' ').trim();
const prompt = normalize(${JSON.stringify(prompt)});
const before = Number(${JSON.stringify(beforeUsers)}) || 0;
const rows = Array.from(document.querySelectorAll('.chat-content-list .chat-content-item, .message-list > *, .segment'))
.filter((row) => /user|sent-by-user|me-/i.test(String(row.className || '')));
return rows.slice(before).some((row) => normalize(row.innerText || row.textContent).includes(prompt));
})()`);
if (verified) return { prompt };
await page.wait(0.2);
}
throw new CommandExecutionError(
'Kimi message submission was not verified',
'The prompt was injected and Send was clicked, but no new user turn containing that prompt appeared.',
);View on GitHub (pinned to 49907e53dc)
Solutions
- Retry the send after a short wait (button may not have been rendered yet).
- Verify the text was actually typed into the composer (a failed type leaves nothing to send).
- Check the Kimi UI for SVG icon name changes and update clickBySvgNameScript usage ('Send').
- Confirm the page is a loaded chat conversation, not a login/redirect page.
Example fix
// before
await page.evaluate(clickBySvgNameScript('Send'));
// after
await page.wait(0.5); // allow button to enable after typing
const res = await page.evaluate(clickBySvgNameScript('Send'));
if (!res?.ok) await page.keyboard.press('Enter'); // fallback Defensive patterns
Strategy: retry
Validate before calling
const sendReady = await page.evaluate(() => {
const btn = document.querySelector('[aria-label*="Send" i], svg[class*="send" i]');
return !!btn;
});
if (!sendReady) await page.wait(1); Type guard
function clickOk(res) { return !!res && res.ok === true; } Try / catch
try {
await cli('kimi', 'send', { text });
} catch (e) {
if (/Send button click failed/i.test(e.message)) {
await page.wait(1);
await cli('kimi', 'send', { text });
} else throw e;
} Prevention
- Verify text landed in the composer before expecting Send to work.
- Wait for the button to render/enable after typing.
- Re-check the Send icon name after Kimi UI updates.
- Prefer Enter-key submit as a fallback in your wrapper.
When it happens
Trigger: Send button not present or not clickable: text insertion failed silently, Kimi renders the send icon with a different SVG name, composer disabled, or button located outside the searched DOM subtree.
Common situations: Kimi UI update renaming the Send SVG icon; composer in a loading/disabled state right after typing; page not fully hydrated; automation on a non-chat page.
Related errors
- composer type failed
- Copy button not visible
- Refresh button not visible
- No messages found in /chat/${id}.
- No chat turns found on current page.
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/7ca9646b4be7a50a.
Report an issue: GitHub.