{"record":{"id":"35920c40d4efa206","repo":"jackwener/OpenCLI","slug":"command-exec-35920c","errorCode":"COMMAND_EXEC","errorMessage":"${reason || 'Unknown Yuanbao send failure.'}${detail ? ` Detail: ${detail}` : ''}","messagePattern":"(.+?)(.+?)` : ''\\}","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/yuanbao/ask.js","lineNumber":339,"sourceCode":"        if (!Number.isInteger(timeout) || timeout < 1) {\n            throw new ArgumentError('--timeout must be a positive integer (seconds)');\n        }\n        const useSearch = normalizeBooleanFlag(kwargs.search, true);\n        const useThink = normalizeBooleanFlag(kwargs.think, false);\n        await ensureYuanbaoPage(page);\n        if (await hasLoginGate(page)) {\n            throw authRequired('Yuanbao opened a login gate before sending the prompt.');\n        }\n        await setYuanbaoInternetSearch(page, useSearch);\n        await setYuanbaoDeepThink(page, useThink);\n        const beforeAssistantMessages = await getYuanbaoAssistantMessages(page);\n        const beforeLines = await getYuanbaoTranscriptLines(page);\n        const sendResult = await sendYuanbaoMessage(page, prompt);\n        if (!sendResult?.ok) {\n            if (await hasLoginGate(page)) {\n                throw authRequired('Yuanbao opened a login gate instead of accepting the prompt.');\n            }\n            throw sendFailure(sendResult?.reason, sendResult?.detail);\n        }\n        const response = await waitForYuanbaoResponse(page, beforeAssistantMessages.length, beforeLines, prompt, timeout);\n        if (response === 'blocked') {\n            throw authRequired('Yuanbao opened a login gate instead of returning a chat response.');\n        }\n        if (!response) {\n            throw new TimeoutError('yuanbao ask', timeout, 'No Yuanbao response was observed before the timeout. Retry with --timeout, and verify the current browser session is still interactive.');\n        }\n        return [\n            { Role: 'User', Text: prompt },\n            { Role: 'Assistant', Text: response },\n        ];\n    },\n});\nexport const __test__ = {\n    collectYuanbaoTranscriptAdditions,\n    convertYuanbaoHtmlToMarkdown,\n    isOnYuanbao,","sourceCodeStart":321,"sourceCodeEnd":357,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/yuanbao/ask.js#L321-L357","documentation":"Generic send-failure error: sendYuanbaoMessage reported !ok but no login gate was detected, so the CLI surfaces the send reason (or 'Unknown Yuanbao send failure.') plus optional detail as a COMMAND_EXEC error. It is the catch-all for non-auth send problems.","triggerScenarios":"sendYuanbaoMessage returns {ok:false, reason, detail} while hasLoginGate(page) is false — e.g. the input box was not found, the send button was disabled, or the DOM changed.","commonSituations":"Yuanbao frontend markup changed so selectors miss the composer; page still loading so the input wasn't interactive; rate limiting or CAPTCHA replacing the composer; network hiccup during send.","solutions":["Re-run the command — transient load timing is the most common cause","Increase page settle/wait time so the composer is fully interactive before sending","Update sendYuanbaoMessage selectors if the Yuanbao UI recently changed","Capture a page screenshot/DOM dump on failure to identify the actual reason in detail"],"exampleFix":"// before: opaque generic failure\nthrow sendFailure(sendResult?.reason, sendResult?.detail);\n// after: retry once before surfacing\nif (!sendResult?.ok) {\n  await page.wait(3);\n  sendResult = await sendYuanbaoMessage(page, prompt);\n  if (!sendResult?.ok) throw sendFailure(sendResult?.reason, sendResult?.detail);\n}","handlingStrategy":"retry","validationCode":"// ensure composer exists before sending\nawait page.waitForSelector(YUANBAO_INPUT_SELECTOR, { visible: true, timeout: 10000 });","typeGuard":"function hasSendDetail(r) {\n  return r != null && typeof r === 'object' && ('reason' in r || 'detail' in r);\n}","tryCatchPattern":"try {\n  return await yuanbaoAsk(page, prompt, { timeout: 60 });\n} catch (e) {\n  if (e.code === 'COMMAND_EXEC' && /Yuanbao send failure/.test(e.message)) {\n    await sleep(3000);\n    return yuanbaoAsk(page, prompt, { timeout: 60 }); // one retry\n  }\n  throw e;\n}","preventionTips":["Retry once with a delay for transient composer-load failures","Wait for the input selector to be visible before sending","Capture a screenshot on failure to diagnose the reason field","Update sendYuanbaoMessage selectors after Yuanbao UI releases"],"tags":["browser-automation","send-failure","yuanbao"],"backgroundTag":"dom-selector-stale","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}