{"record":{"id":"28b01860acea3a08","repo":"jackwener/OpenCLI","slug":"auth-required-28b018","errorCode":"AUTH_REQUIRED","errorMessage":"Yuanbao opened a login gate before sending the prompt.","messagePattern":"Yuanbao opened a login gate before sending the prompt\\.","errorType":"exception","errorClass":"AuthRequiredError","httpStatus":null,"severity":"error","filePath":"clis/yuanbao/send.js","lineNumber":35,"sourceCode":"    description: 'Fire-and-forget: send a prompt to Yuanbao without waiting for the reply',\n    domain: YUANBAO_DOMAIN,\n    strategy: Strategy.COOKIE,\n    browser: true,\n    siteSession: 'persistent',\n    navigateBefore: false,\n    args: [\n        { name: 'prompt', positional: true, required: true, help: 'Prompt to send to Yuanbao' },\n        { name: 'new', type: 'boolean', default: false, help: 'Start a new chat before sending' },\n    ],\n    columns: ['Status', 'Prompt'],\n    func: async (page, kwargs) => {\n        const prompt = String(kwargs.prompt || '').trim();\n        if (!prompt) throw new ArgumentError('prompt', 'is required');\n        const startFresh = normalizeBooleanFlag(kwargs.new, false);\n\n        await ensureYuanbaoPage(page);\n        if (await hasLoginGate(page)) {\n            throw authRequired('Yuanbao opened a login gate before sending the prompt.');\n        }\n        if (startFresh) {\n            const action = await startNewYuanbaoChat(page);\n            if (action === 'blocked') {\n                throw authRequired('Yuanbao opened a login gate while starting a new chat.');\n            }\n        }\n        const send = await sendYuanbaoMessage(page, prompt);\n        if (!send?.ok) {\n            if (await hasLoginGate(page)) {\n                throw authRequired('Yuanbao opened a login gate instead of accepting the prompt.');\n            }\n            throw new CommandExecutionError(\n                send?.reason || 'Failed to send Yuanbao prompt',\n                send?.detail\n                    ? `Detail: ${send.detail}`\n                    : 'Make sure the Yuanbao chat composer is visible and not in a disabled state.',\n            );","sourceCodeStart":17,"sourceCodeEnd":53,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/yuanbao/send.js#L17-L53","documentation":"The `yuanbao send` command checks hasLoginGate(page) after ensuring the Yuanbao page is loaded, before attempting to send the prompt. If the login gate is visible, the command throws AUTH_REQUIRED because the prompt cannot reach an unauthenticated chat UI.","triggerScenarios":"Calling `yuanbao send --prompt \"...\"` (with or without --new) when the loaded Yuanbao page shows the login gate; also reachable via the follow-up check when startNewYuanbaoChat returns 'blocked'.","commonSituations":"Session cookies expired between runs, running inside CI with a browser profile lacking login state, or Yuanbao forcing re-login after policy/security changes.","solutions":["Authenticate in the automation browser profile and rerun the send command.","Persist cookies via a dedicated user data dir so authentication survives restarts.","Add a pre-flight login-gate check in your script and trigger interactive login before sending.","Confirm you are not pointing the daemon at the wrong (unauthenticated) browser context."],"exampleFix":"// before\nawait cli.run(['yuanbao', 'send', '--prompt', 'hi']);\n// after\ntry {\n  await cli.run(['yuanbao', 'send', '--prompt', 'hi']);\n} catch (e) {\n  if (e.code === 'AUTH_REQUIRED') { await loginToYuanbao(page); await cli.run(['yuanbao', 'send', '--prompt', 'hi']); }\n  else throw e;\n}","handlingStrategy":"validation","validationCode":"await ensureYuanbaoPage(page);\nif (await hasLoginGate(page)) {\n  throw new Error('Login required: authenticate before sending');\n}\nawait cli.run(['yuanbao', 'send', '--prompt', prompt]);","typeGuard":null,"tryCatchPattern":"try {\n  await cli.run(['yuanbao', 'send', '--prompt', prompt]);\n} catch (e) {\n  if (e.code === 'AUTH_REQUIRED') { await loginToYuanbao(page); await cli.run(['yuanbao', 'send', '--prompt', prompt]); }\n  else throw e;\n}","preventionTips":["Always call a login-gate check before send operations.","Reuse one authenticated browser context across commands.","Handle AUTH_REQUIRED with one retry after re-login.","Log in fully before scripted runs, especially in CI."],"tags":["authentication","browser-automation","yuanbao"],"backgroundTag":"browser-login-required","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}