{"record":{"id":"d1d527b8be9eb832","repo":"jackwener/OpenCLI","slug":"failed-to-send-message","errorCode":null,"errorMessage":"Failed to send message","messagePattern":"Failed to send message","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/claude/ask.js","lineNumber":133,"sourceCode":"                // SPA navigates after send; \"Promise was collected\" means send succeeded\n                if (!String(err?.message || err).includes('Promise was collected')) throw err;\n            }\n            // Pre-waitForResponse settle dropped — waitForResponse's first 3 s polling\n            // tick covers the same window without an unconditional sleep.\n            const result = await waitForResponse(page, baseline, prompt, timeoutMs);\n            if (!result) {\n                throw new EmptyResultError(\n                    'claude ask',\n                    `No Claude response appeared within ${timeoutSeconds}s. Re-run with a higher --timeout if the model is still generating.`,\n                );\n            }\n            return [{ response: result }];\n        }\n\n        const baseline = await withRetry(() => getBubbleCount(page));\n        const sendResult = await withRetry(() => sendMessage(page, prompt));\n        if (!sendResult?.ok) {\n            throw new CommandExecutionError(sendResult?.reason || 'Failed to send message');\n        }\n\n        const result = await waitForResponse(page, baseline, prompt, timeoutMs);\n        if (!result) {\n            throw new EmptyResultError(\n                'claude ask',\n                `No Claude response appeared within ${timeoutSeconds}s. Re-run with a higher --timeout if the model is still generating.`,\n            );\n        }\n        return [{ response: result }];\n    },\n});\n","sourceCodeStart":115,"sourceCodeEnd":146,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/claude/ask.js#L115-L146","documentation":"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'.","triggerScenarios":"`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.","commonSituations":"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.","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."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// Ensure a live session before sending\nawait opencli.claude.whoami(); // throws AuthRequiredError early if session is dead","typeGuard":null,"tryCatchPattern":"try {\n  return await opencli.claude.ask(prompt);\n} catch (e) {\n  if (/Failed to send message/.test(e.message)) {\n    await sleep(5000);\n    return await opencli.claude.ask(prompt, { new: true });\n  }\n  throw e;\n}","preventionTips":["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."],"tags":["send-failure","browser-automation","network"],"backgroundTag":"message-send-failed","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}