{"record":{"id":"75c2b92e1eca5c30","repo":"jackwener/OpenCLI","slug":"qianwen-ask","errorCode":null,"errorMessage":"qianwen ask","messagePattern":"qianwen ask","errorType":"exception","errorClass":"TimeoutError","httpStatus":null,"severity":"warning","filePath":"clis/qwen/ask.js","lineNumber":75,"sourceCode":"        }\n\n        if (useThink) await setFeatureToggle(page, 'think', true);\n        if (useResearch) await setFeatureToggle(page, 'research', true);\n\n        // Anchor on the visible transcript BEFORE sending so waitForAnswer can\n        // bind the reply to the newly sent prompt instead of an older answer.\n        const baselineAnchor = await getBaselineChatAnchor(page);\n\n        const send = await sendMessage(page, prompt);\n        if (!send?.ok) {\n            if (await hasLoginGate(page)) throw authRequired();\n            throw new CommandExecutionError(send?.reason || 'Failed to send Qianwen prompt');\n        }\n\n        const result = await waitForAnswer(page, prompt, timeout, baselineAnchor);\n        if (result.status === 'auth_required') throw authRequired();\n        if (result.status === 'timeout') {\n            throw new TimeoutError('qianwen ask', timeout, 'No Qianwen reply observed before timeout. Retry with --timeout increased.');\n        }\n        const assistant = result.assistant;\n        if (!assistant) {\n            throw new CommandExecutionError('No assistant reply found in Qianwen chat.');\n        }\n        const answer = wantMarkdown && assistant.html\n            ? (bubbleHtmlToMarkdown(assistant.html) || assistant.text)\n            : assistant.text;\n        return [\n            { Role: 'User', Text: prompt },\n            { Role: 'Assistant', Text: answer },\n        ];\n    },\n});\n\nasync function getBaselineChatAnchor(page) {\n    const bubbles = await getMessageBubbles(page);\n    const lastBubbleId = bubbles.length ? bubbles[bubbles.length - 1].id : '';","sourceCodeStart":57,"sourceCodeEnd":93,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/qwen/ask.js#L57-L93","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Re-run with a larger --timeout (e.g. --timeout 300), as the error hint suggests.","Disable --think/--research flags for quicker answers.","Verify network/page liveness; foreground the tab so timers are not throttled.","Check whether the answer actually arrived after the timeout and adjust the answer-detection anchor if the UI changed."],"exampleFix":"// before\nawait qwenAsk(page, { prompt: question, timeout: 60 });\n// after\nawait qwenAsk(page, { prompt: question, timeout: 300 });","handlingStrategy":"retry","validationCode":"const timeout = wantDeepResearch ? 600 : 180; // size timeout to the workload","typeGuard":"function isTimeoutError(e) {\n  return e instanceof TimeoutError || /qianwen ask/.test(String(e?.message));\n}","tryCatchPattern":"try {\n  ans = await qwenAsk(page, { prompt, timeout });\n} catch (e) {\n  if (isTimeoutError(e)) {\n    ans = await qwenAsk(page, { prompt, timeout: timeout * 2 }); // escalate\n  } else { throw e; }\n}","preventionTips":["Use large timeouts for --think/--research queries","Keep the automation tab foregrounded to avoid timer throttling","Retry with exponentially larger timeout before giving up","Avoid very long prompts that increase generation time"],"tags":["timeout","browser-automation","polling"],"backgroundTag":"operation-timeout","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}