jackwener/OpenCLI · error · AuthRequiredError
AUTH_REQUIRED
AUTH_REQUIRED
Error message
Yuanbao opened a login gate instead of returning a chat response.
What it means
The prompt was accepted, but while waiting for the assistant response the CLI detected a login gate ('blocked' result from waitForYuanbaoResponse), meaning Yuanbao invalidated the session mid-conversation and threw AUTH_REQUIRED instead of timing out.
Source
Thrown at clis/yuanbao/ask.js:343
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.');
}
return [
{ Role: 'User', Text: prompt },
{ Role: 'Assistant', Text: response },
];
},
});
export const __test__ = {
collectYuanbaoTranscriptAdditions,
convertYuanbaoHtmlToMarkdown,
isOnYuanbao,
normalizeBooleanFlag,
pickLatestYuanbaoAssistantCandidate,
sanitizeYuanbaoResponseText,
updateStableState,View on GitHub (pinned to 49907e53dc)
Solutions
- Log into Yuanbao in the automation browser and retry the ask command
- Clear Yuanbao cookies and re-login to eliminate the stale session
- Use an account with valid access to the agent and avoid concurrent logins from other devices
- Reduce wait time/retry promptly after re-login so the session stays fresh
Example fix
// before: treating 'blocked' as a timeout
const response = await waitForYuanbaoResponse(...);
if (!response) throw new TimeoutError(...);
// after: handle blocked separately with re-auth
if (response === 'blocked') { await yuanbaoLogin(); return yuanbaoAsk(prompt); } Defensive patterns
Strategy: try-catch
Validate before calling
await ensureYuanbaoPage(page); if (await hasLoginGate(page)) await yuanbaoLogin(page); // verify session before long waits
Type guard
function isAuthError(e) {
return e != null && (e.code === 'AUTH_REQUIRED' || /login gate/i.test(e?.message ?? ''));
} Try / catch
try {
return await yuanbaoAsk(page, prompt, { timeout });
} catch (e) {
if (e.code === 'AUTH_REQUIRED') { await yuanbaoLogin(page); return yuanbaoAsk(page, prompt, { timeout }); }
if (e instanceof TimeoutError) { /* increase timeout or give up */ }
throw e;
} Prevention
- Handle 'blocked' responses as auth, not timeout, in wrappers
- Keep the session alive during long waits (heartbeat or shorter timeout + retry)
- Avoid concurrent logins on the same account mid-conversation
- Re-authenticate promptly after any AUTH_REQUIRED instead of retrying the same session
When it happens
Trigger: waitForYuanbaoResponse returns 'blocked' because hasLoginGate became true between prompt submission and response arrival in the yuanbao ask flow.
Common situations: Session cookie expiring during a long wait; concurrent login elsewhere invalidating the session; Yuanbao injecting an auth wall for rate-limited or anonymous users mid-conversation.
Related errors
- Yuanbao opened a login gate before sending the prompt. ${SES
- Yuanbao opened a login gate instead of accepting the prompt.
- 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/87d8c1dd6e499bd0.
Report an issue: GitHub.