jackwener/OpenCLI · error · CommandExecutionError
Failed to send Qianwen image prompt
Error message
Failed to send Qianwen image prompt
What it means
After toggling image mode, clis/qwen/image.js calls sendMessage(page, prompt); if the result lacks ok:true it throws CommandExecutionError with the sender's reason, or the generic 'Failed to send Qianwen image prompt' when no reason is given. A login gate on the page is checked first and surfaced as an auth error instead. This indicates the prompt never reached the chat.
Source
Thrown at clis/qwen/image.js:136
const skipDownload = normalizeBooleanFlag(kwargs.sd, false);
const timeout = Number(kwargs.timeout ?? 180);
if (!Number.isInteger(timeout) || timeout <= 0) {
throw new ArgumentError('timeout must be a positive integer');
}
await ensureOnQianwen(page);
await dismissLoginModal(page);
if (startFresh) {
await startNewChat(page);
await dismissLoginModal(page);
}
await setFeatureToggle(page, 'image', true);
await page.wait(0.5);
const send = await sendMessage(page, prompt);
if (!send?.ok) {
if (await hasLoginGate(page)) throw authRequired();
throw new CommandExecutionError(send?.reason || 'Failed to send Qianwen image prompt');
}
// Grab the newest assistant bubble id after send by polling briefly
let targetId = '';
for (let i = 0; i < 5; i += 1) {
await page.wait(1);
const bubbles = await getMessageBubbles(page);
const lastAnswer = [...bubbles].reverse().find((b) => b.role === 'Assistant');
if (lastAnswer) { targetId = lastAnswer.id; break; }
}
const waitResult = await waitForImageUrls(page, targetId, timeout);
const link = await page.evaluate('window.location.href').catch(() => 'https://www.qianwen.com/');
if (waitResult.status === 'auth_required') throw authRequired();
if (waitResult.status === 'timeout') {
throw new TimeoutError('qianwen image', timeout, 'No generated images observed before timeout.');
}
View on GitHub (pinned to 49907e53dc)
Solutions
- Re-run after confirming you are logged in to qianwen.com in the automation browser (check for the login modal/gate)
- Start a fresh chat (the command's new flag defaults true) so the composer is idle and enabled
- Retry once after a short wait — transient DOM/network flakiness is common
- If it persists, inspect the page: the send-button/input selectors in sendMessage likely need updating after a site update
Example fix
// before clis qwen image --prompt 'sunset' # fails mid-session with stale composer // after clis qwen image --prompt 'sunset' --new true # force fresh chat before sending
Defensive patterns
Strategy: try-catch
Validate before calling
null
Type guard
null
Try / catch
try {
await runQianwenImage(prompt);
} catch (e) {
if (/Failed to send Qianwen image prompt/.test(e.message)) {
await ensureLoggedIn(page); // re-check login state
await sleep(2000); // brief backoff for transient DOM flake
await runQianwenImage(prompt); // single retry, fresh chat
} else throw e;
} Prevention
- Confirm the automation browser has an active qianwen.com session before running
- Always start from a fresh chat so the composer is idle and enabled
- Avoid sending while a previous generation is still in progress
- Update selectors in sendMessage promptly after Qianwen UI changes
When it happens
Trigger: sendMessage fails to locate the input box or submit button, the page DOM changed, the session was logged out mid-flow (and hasLoginGate misses it), or the composer is disabled while a previous request is still generating.
Common situations: Qianwen frontend update renaming composer selectors; expired cookies so the send button no-ops; sending a new image prompt while the previous generation is still running; network hiccup during page load.
Related errors
- Failed to send Qianwen prompt
- Failed to extract Booking.com cards: ${err?.message || err}
- Failed to send message
- coupang add-to-cart evaluation failed: ${error?.message || e
- coupang search
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/db10fb9b86fe8df8.
Report an issue: GitHub.