jackwener/OpenCLI · error · CommandExecutionError
Failed to send message
Error message
Failed to send message
What it means
sendMessage() failed to submit the prompt into the composer (sendResult not ok). The library raises CommandExecutionError with the specific reason when available, else the generic 'Failed to send message'.
Source
Thrown at clis/claude/ask.js:133
// SPA navigates after send; "Promise was collected" means send succeeded
if (!String(err?.message || err).includes('Promise was collected')) throw err;
}
// Pre-waitForResponse settle dropped — waitForResponse's first 3 s polling
// tick covers the same window without an unconditional sleep.
const result = await waitForResponse(page, baseline, prompt, timeoutMs);
if (!result) {
throw new EmptyResultError(
'claude ask',
`No Claude response appeared within ${timeoutSeconds}s. Re-run with a higher --timeout if the model is still generating.`,
);
}
return [{ response: result }];
}
const baseline = await withRetry(() => getBubbleCount(page));
const sendResult = await withRetry(() => sendMessage(page, prompt));
if (!sendResult?.ok) {
throw new CommandExecutionError(sendResult?.reason || 'Failed to send message');
}
const result = await waitForResponse(page, baseline, prompt, timeoutMs);
if (!result) {
throw new EmptyResultError(
'claude ask',
`No Claude response appeared within ${timeoutSeconds}s. Re-run with a higher --timeout if the model is still generating.`,
);
}
return [{ response: result }];
},
});
View on GitHub (pinned to 49907e53dc)
Solutions
- Re-run the command; withRetry may succeed on a fresh attempt.
- Verify the claude.ai session is valid and the composer renders (re-authenticate if needed).
- Check for Claude-side banners (rate limits, out of credits) blocking submission.
- Update opencli if Claude's composer markup changed.
Defensive patterns
Strategy: retry
Validate before calling
// Ensure a live session before sending await opencli.claude.whoami(); // throws AuthRequiredError early if session is dead
Try / catch
try {
return await opencli.claude.ask(prompt);
} catch (e) {
if (/Failed to send message/.test(e.message)) {
await sleep(5000);
return await opencli.claude.ask(prompt, { new: true });
}
throw e;
} Prevention
- Validate the session (whoami) before batch sends.
- Watch for Claude-side banners (rate limits, credits) that block the composer.
- Use --new when a stale conversation state seems to block sending.
- Keep opencli updated for composer selector changes.
When it happens
Trigger: `claude ask "..."` without --file where withRetry(sendMessage) returns {ok:false} — composer not found or disabled, send button unreachable, network hiccup, or send rejected by the page.
Common situations: Claude web session logged out mid-run; rate-limit/credit-exhausted banner blocking the composer; UI change breaking the send selector; composer never mounted after navigation.
Related errors
- Barchart greeks request failed: ${data.message || 'unknown e
- Failed to load Booking.com search page: ${err?.message || er
- Failed to open Chess.com analysis board: ${error?.message ||
- coupang search filtered navigation failed: ${error?.message
- Gitee whoami failed: ${probe.detail}
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/d1d527b8be9eb832.
Report an issue: GitHub.