jackwener/OpenCLI · warning · TimeoutError

qianwen ask

Error message

qianwen ask

What it means

TimeoutError for the operation named 'qianwen ask' with the configured timeout seconds and hint 'No Qianwen reply observed before timeout. Retry with --timeout increased.' Thrown by waitForAnswer's timeout status — the prompt was sent but no matching assistant answer appeared in time.

Source

Thrown at clis/qwen/ask.js:75

        }

        if (useThink) await setFeatureToggle(page, 'think', true);
        if (useResearch) await setFeatureToggle(page, 'research', true);

        // Anchor on the visible transcript BEFORE sending so waitForAnswer can
        // bind the reply to the newly sent prompt instead of an older answer.
        const baselineAnchor = await getBaselineChatAnchor(page);

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

        const result = await waitForAnswer(page, prompt, timeout, baselineAnchor);
        if (result.status === 'auth_required') throw authRequired();
        if (result.status === 'timeout') {
            throw new TimeoutError('qianwen ask', timeout, 'No Qianwen reply observed before timeout. Retry with --timeout increased.');
        }
        const assistant = result.assistant;
        if (!assistant) {
            throw new CommandExecutionError('No assistant reply found in Qianwen chat.');
        }
        const answer = wantMarkdown && assistant.html
            ? (bubbleHtmlToMarkdown(assistant.html) || assistant.text)
            : assistant.text;
        return [
            { Role: 'User', Text: prompt },
            { Role: 'Assistant', Text: answer },
        ];
    },
});

async function getBaselineChatAnchor(page) {
    const bubbles = await getMessageBubbles(page);
    const lastBubbleId = bubbles.length ? bubbles[bubbles.length - 1].id : '';

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Re-run with a larger --timeout (e.g. --timeout 300), as the error hint suggests.
  2. Disable --think/--research flags for quicker answers.
  3. Verify network/page liveness; foreground the tab so timers are not throttled.
  4. Check whether the answer actually arrived after the timeout and adjust the answer-detection anchor if the UI changed.

Example fix

// before
await qwenAsk(page, { prompt: question, timeout: 60 });
// after
await qwenAsk(page, { prompt: question, timeout: 300 });
Defensive patterns

Strategy: retry

Validate before calling

const timeout = wantDeepResearch ? 600 : 180; // size timeout to the workload

Type guard

function isTimeoutError(e) {
  return e instanceof TimeoutError || /qianwen ask/.test(String(e?.message));
}

Try / catch

try {
  ans = await qwenAsk(page, { prompt, timeout });
} catch (e) {
  if (isTimeoutError(e)) {
    ans = await qwenAsk(page, { prompt, timeout: timeout * 2 }); // escalate
  } else { throw e; }
}

Prevention

When it happens

Trigger: waitForAnswer polls until `timeout` seconds elapse without detecting an assistant bubble bound to the baseline chat anchor — slow model responses, DeepResearch mode still running, or the reply rendering in a way the detector does not recognize.

Common situations: Long 'think' or DeepResearch answers exceeding the default 120s; heavy load on qwen.ai causing queueing; page throttled in background/headless tabs so polling JS runs slowly.

Related errors


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