jackwener/OpenCLI · error · AuthRequiredError
Yuanbao opened a login gate before sending the prompt. ${SES
Error message
Yuanbao opened a login gate before sending the prompt. ${SESSION_HINT} What it means
Before sending the prompt, the Yuanbao web page already shows a login gate (auth wall), so the CLI aborts with an AUTH_REQUIRED error rather than submitting a message that would fail. SESSION_HINT is appended to guide the user to fix their browser session.
Source
Thrown at clis/yuanbao/ask.js:328
defaultFormat: 'plain',
args: [
{ name: 'prompt', required: true, positional: true, help: 'Prompt to send' },
{ name: 'timeout', type: 'int', required: false, help: 'Max seconds to wait (default: 60)', default: 60 },
{ name: 'search', type: 'boolean', required: false, help: 'Enable Yuanbao internet search (default: true)', default: true },
{ name: 'think', type: 'boolean', required: false, help: 'Enable Yuanbao deep thinking (default: false)', default: false },
],
columns: ['Role', 'Text'],
func: async (page, kwargs) => {
const prompt = kwargs.prompt;
const timeout = kwargs.timeout;
if (!Number.isInteger(timeout) || timeout < 1) {
throw new ArgumentError('--timeout must be a positive integer (seconds)');
}
const useSearch = normalizeBooleanFlag(kwargs.search, true);
const useThink = normalizeBooleanFlag(kwargs.think, false);
await ensureYuanbaoPage(page);
if (await hasLoginGate(page)) {
throw authRequired('Yuanbao opened a login gate before sending the prompt.');
}
await setYuanbaoInternetSearch(page, useSearch);
await setYuanbaoDeepThink(page, useThink);
const beforeAssistantMessages = await getYuanbaoAssistantMessages(page);
const beforeLines = await getYuanbaoTranscriptLines(page);
const sendResult = await sendYuanbaoMessage(page, prompt);
if (!sendResult?.ok) {
if (await hasLoginGate(page)) {
throw authRequired('Yuanbao opened a login gate instead of accepting the prompt.');
}
throw sendFailure(sendResult?.reason, sendResult?.detail);
}
const response = await waitForYuanbaoResponse(page, beforeAssistantMessages.length, beforeLines, prompt, timeout);
if (response === 'blocked') {
throw authRequired('Yuanbao opened a login gate instead of returning a chat response.');
}
if (!response) {
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.');View on GitHub (pinned to 49907e53dc)
Solutions
- Open the browser profile used by the CLI and log into Yuanbao manually to refresh the session
- Clear Yuanbao cookies and re-login so no stale gate-triggering cookies remain
- Verify YUANBAO_URL points to the correct, non-login-redirecting host
- Re-run the command immediately after login while the session cookie is fresh
Example fix
// before: assuming a session exists
await ensureYuanbaoPage(page);
await sendYuanbaoMessage(page, prompt);
// after: caller checks and re-authenticates on AUTH_REQUIRED
try {
await yuanbaoAsk(prompt);
} catch (e) {
if (e.code === 'AUTH_REQUIRED') { await yuanbaoLogin(); return yuanbaoAsk(prompt); }
throw e;
} Defensive patterns
Strategy: validation
Validate before calling
import { hasLoginGate } from './yuanbao/page.js';
await ensureYuanbaoPage(page);
if (await hasLoginGate(page)) {
await yuanbaoLogin(page); // re-auth before calling ask
} Type guard
async function isYuanbaoSessionValid(page) {
return !(await hasLoginGate(page));
} Try / catch
try {
return await yuanbaoAsk(page, prompt);
} catch (e) {
if (e.code === 'AUTH_REQUIRED') {
await yuanbaoLogin(page);
return yuanbaoAsk(page, prompt);
}
throw e;
} Prevention
- Log into Yuanbao in the persistent browser profile before running commands
- Schedule periodic session refresh so cookies don't expire between runs
- Check hasLoginGate right after page load in your own wrapper
- Avoid concurrent logins that invalidate the automation session
When it happens
Trigger: Calling the yuanbao ask command when ensureYuanbaoPage leaves the page in a logged-out state and hasLoginGate(page) returns true prior to sendYuanbaoMessage.
Common situations: Expired Yuanbao/tencent browser cookies; headless browser profile never logged in; Yuanbao forced re-login after policy change or long inactivity; incognito profile without persisted session.
Related errors
- Yuanbao opened a login gate instead of accepting the prompt.
- AUTH_REQUIRED
- AUTH_REQUIRED
- Ctrip flight API returned HTTP ${status}; complete any verif
- Flomo memos requires an active signed-in Flomo browser sessi
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/2e8564bbd8384100.
Report an issue: GitHub.