jackwener/OpenCLI · error · TimeoutError

qianwen image

qianwen image

Error message

No generated images observed before timeout.

What it means

clis/qwen/image.js polls waitForImageUrls(page, targetId, timeout) for generated image URLs; if the status comes back 'timeout' it throws TimeoutError('qianwen image', timeout, 'No generated images observed before timeout.'). Image generation simply did not produce any <img> result within the allotted seconds.

Source

Thrown at clis/qwen/image.js:152

        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.');
        }

        const urls = waitResult.urls;
        if (skipDownload) {
            return [{ Status: '🎨 generated', File: null, Link: link }];
        }

        const stamp = Date.now();
        const results = [];
        for (let i = 0; i < urls.length; i += 1) {
            const url = urls[i];
            const asset = await fetchImageAsset(page, url);
            if (!asset?.ok) {
                throw new CommandExecutionError(`Failed to fetch generated Qianwen image ${i + 1}: status=${asset?.status || '?'}`);
            }
            const suffix = urls.length > 1 ? `_${i + 1}` : '';
            const ext = extFromMime(asset.mime);
            const filePath = path.join(outputDir, `qianwen_${stamp}${suffix}${ext}`);

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Increase --timeout (e.g. 300-600) and retry — image generation often exceeds 180s under load
  2. Simplify or rephrase the prompt; content-policy refusals produce no images at all
  3. Verify the sent prompt actually started generating (check the chat in the browser)
  4. Retry later if the service is degraded/queued — server-side latency is outside your control

Example fix

// before
clis qwen image --prompt 'elaborate fantasy scene' --timeout 60
// after
clis qwen image --prompt 'elaborate fantasy scene' --timeout 600
Defensive patterns

Strategy: retry

Validate before calling

null

Type guard

null

Try / catch

try {
  const results = await runQianwenImage(prompt, { timeout: 600 });
} catch (e) {
  if (e instanceof TimeoutError && e.operation === 'qianwen image') {
    console.warn(`No images after ${e.timeout}s; retrying once with a simpler prompt`);
    await runQianwenImage(simplify(prompt), { timeout: 600 });
  } else throw e;
}

Prevention

When it happens

Trigger: Image generation takes longer than the --timeout value (default 180s); the prompt was rejected or the model returned text only; generation stalled after send; the target assistant bubble (targetId) never received image elements.

Common situations: Complex prompts queuing behind heavy server load; free-tier rate limiting slowing generation; very short custom timeouts (e.g. --timeout 30) on a feature that usually takes 1-3 minutes; content-policy refusal producing no images.

Understand the failure class

Related errors


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