jackwener/OpenCLI · error · AuthRequiredError

AUTH_REQUIRED

AUTH_REQUIRED

Error message

Yuanbao opened a login gate before sending the prompt.

What it means

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.

Source

Thrown at clis/yuanbao/send.js:35

    description: 'Fire-and-forget: send a prompt to Yuanbao without waiting for the reply',
    domain: YUANBAO_DOMAIN,
    strategy: Strategy.COOKIE,
    browser: true,
    siteSession: 'persistent',
    navigateBefore: false,
    args: [
        { name: 'prompt', positional: true, required: true, help: 'Prompt to send to Yuanbao' },
        { name: 'new', type: 'boolean', default: false, help: 'Start a new chat before sending' },
    ],
    columns: ['Status', 'Prompt'],
    func: async (page, kwargs) => {
        const prompt = String(kwargs.prompt || '').trim();
        if (!prompt) throw new ArgumentError('prompt', 'is required');
        const startFresh = normalizeBooleanFlag(kwargs.new, false);

        await ensureYuanbaoPage(page);
        if (await hasLoginGate(page)) {
            throw authRequired('Yuanbao opened a login gate before sending the prompt.');
        }
        if (startFresh) {
            const action = await startNewYuanbaoChat(page);
            if (action === 'blocked') {
                throw authRequired('Yuanbao opened a login gate while starting a new chat.');
            }
        }
        const send = await sendYuanbaoMessage(page, prompt);
        if (!send?.ok) {
            if (await hasLoginGate(page)) {
                throw authRequired('Yuanbao opened a login gate instead of accepting the prompt.');
            }
            throw new CommandExecutionError(
                send?.reason || 'Failed to send Yuanbao prompt',
                send?.detail
                    ? `Detail: ${send.detail}`
                    : 'Make sure the Yuanbao chat composer is visible and not in a disabled state.',
            );

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Authenticate in the automation browser profile and rerun the send command.
  2. Persist cookies via a dedicated user data dir so authentication survives restarts.
  3. Add a pre-flight login-gate check in your script and trigger interactive login before sending.
  4. Confirm you are not pointing the daemon at the wrong (unauthenticated) browser context.

Example fix

// before
await cli.run(['yuanbao', 'send', '--prompt', 'hi']);
// after
try {
  await cli.run(['yuanbao', 'send', '--prompt', 'hi']);
} catch (e) {
  if (e.code === 'AUTH_REQUIRED') { await loginToYuanbao(page); await cli.run(['yuanbao', 'send', '--prompt', 'hi']); }
  else throw e;
}
Defensive patterns

Strategy: validation

Validate before calling

await ensureYuanbaoPage(page);
if (await hasLoginGate(page)) {
  throw new Error('Login required: authenticate before sending');
}
await cli.run(['yuanbao', 'send', '--prompt', prompt]);

Try / catch

try {
  await cli.run(['yuanbao', 'send', '--prompt', prompt]);
} catch (e) {
  if (e.code === 'AUTH_REQUIRED') { await loginToYuanbao(page); await cli.run(['yuanbao', 'send', '--prompt', prompt]); }
  else throw e;
}

Prevention

When it happens

Trigger: 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'.

Common situations: Session cookies expired between runs, running inside CI with a browser profile lacking login state, or Yuanbao forcing re-login after policy/security changes.

Related errors


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