jackwener/OpenCLI · error · CommandExecutionError

Failed to send Qianwen prompt

Error message

Failed to send Qianwen prompt

What it means

clis/qwen/send.js calls sendMessage(page, prompt) after applying think/research toggles; if send?.ok is falsy it checks hasLoginGate (throwing an auth error if present), otherwise throws CommandExecutionError(send?.reason || 'Failed to send Qianwen prompt'). The text prompt was not delivered to the chat.

Solutions

  1. Confirm login state in the automation browser and retry (a visible login gate means re-authenticate)
  2. Retry after a slightly longer initial wait so the composer is fully rendered
  3. Disable --think/--research toggles to isolate whether a toggle breaks the send
  4. If persistent, the sendMessage selectors likely need updating after a Qianwen UI change

Example fix

// before
clis qwen send --prompt 'hi' --research true   # fails: feature/composer unavailable
// after
clis qwen send --prompt 'hi'   # send without toggles, add toggles back incrementally
Defensive patterns

Strategy: try-catch

Validate before calling

null

Type guard

null

Try / catch

try {
  await runQianwenSend({ prompt, think, research });
} catch (e) {
  if (/Failed to send Qianwen prompt/.test(e.message)) {
    if (think || research) {
      return runQianwenSend({ prompt });   // retry without feature toggles
    }
    await ensureLoggedIn(page);
    await sleep(2000);
    return runQianwenSend({ prompt });     // retry once
  } else throw e;
}

Prevention

When it happens

Trigger: The composer input or send button was not found (DOM change, page still loading); the session is logged out but the gate check misses it; DeepThink/DeepResearch toggle interaction left the composer disabled; send timed out silently giving no reason.

Common situations: Slow page load so sendMessage runs before the composer renders; expired login cookies; site update renaming the send button selector; toggling research mode on an account where the feature is unavailable.

Related errors


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

Appendix: source

Thrown at clis/qwen/send.js:51

        const prompt = String(kwargs.prompt || '').trim();
        if (!prompt) throw new ArgumentError('prompt is required');
        const startFresh = normalizeBooleanFlag(kwargs.new, false);
        const useThink = normalizeBooleanFlag(kwargs.think, false);
        const useResearch = normalizeBooleanFlag(kwargs.research, false);

        await ensureOnQianwen(page);
        await dismissLoginModal(page);
        if (startFresh) {
            await startNewChat(page);
            await dismissLoginModal(page);
        }
        if (useThink) await setFeatureToggle(page, 'think', true);
        if (useResearch) await setFeatureToggle(page, 'research', true);

        const send = await sendMessage(page, prompt);
        if (!send?.ok) {
            if (await hasLoginGate(page)) throw authRequired();
            throw new CommandExecutionError(send?.reason || 'Failed to send Qianwen prompt');
        }
        return [{ Status: 'sent', Prompt: prompt }];
    },
});

View on GitHub (pinned to 49907e53dc)