jackwener/OpenCLI · error · AuthRequiredError

AUTH_REQUIRED

AUTH_REQUIRED

Error message

Yuanbao opened a login gate instead of starting a new chat.

What it means

The `yuanbao new` command calls startNewYuanbaoChat(page), which returned 'blocked' because Yuanbao presented a login gate instead of the homepage/new-chat flow. The library surfaces this as AUTH_REQUIRED since a new chat cannot be started while unauthenticated.

Source

Thrown at clis/yuanbao/new.js:65

    await page.wait(1);
    return 'navigate';
}
export const newCommand = cli({
    site: 'yuanbao',
    name: 'new',
    access: 'read',
    description: 'Start a new conversation in Yuanbao web chat',
    domain: YUANBAO_DOMAIN,
    strategy: Strategy.COOKIE,
    browser: true,
    siteSession: 'persistent',
    navigateBefore: false,
    args: [],
    columns: ['Status', 'Action'],
    func: async (page) => {
        const action = await startNewYuanbaoChat(page);
        if (action === 'blocked') {
            throw authRequired('Yuanbao opened a login gate instead of starting a new chat.');
        }
        return [{
                Status: 'Success',
                Action: action === 'navigate' ? 'Reloaded Yuanbao homepage as fallback' : 'Clicked New chat',
            }];
    },
});

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Log in to Yuanbao in the automation browser profile, then rerun `yuanbao new`.
  2. Use a persisted user-data-dir profile that retains authenticated cookies.
  3. Check whether the account was logged out remotely and re-authenticate.
  4. If the gate persists on a logged-in profile, clear stale Yuanbao cookies for the domain and log in again.

Example fix

// before
await cli.run(['yuanbao', 'new']);
// after: guard with an auth pre-check
if (await hasLoginGate(page)) {
  await promptInteractiveLogin(page);
}
await cli.run(['yuanbao', 'new']);
Defensive patterns

Strategy: try-catch

Validate before calling

// pre-check before invoking 'new'
if (await hasLoginGate(page)) await loginToYuanbao(page);

Try / catch

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

Prevention

When it happens

Trigger: Running `yuanbao new` when startNewYuanbaoChat detects a login gate — the click/fallback navigation to the Yuanbao homepage lands on the login wall and the function returns action === 'blocked'.

Common situations: Expired session on a long-lived automation browser, fresh profile never logged in, or Yuanbao invalidating sessions server-side (e.g., after a security logout or password change).

Related errors


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