jackwener/OpenCLI · error · AuthRequiredError
AUTH_REQUIRED
AUTH_REQUIRED
Error message
Yuanbao opened a login gate when navigating to the conversation.
What it means
Navigating to a Yuanbao conversation URL landed on a login gate instead of the transcript, so the detail command throws AUTH_REQUIRED immediately after page load. The conversation history cannot be read without an authenticated session.
Source
Thrown at clis/yuanbao/detail.js:37
strategy: Strategy.COOKIE,
browser: true,
siteSession: 'persistent',
navigateBefore: false,
args: [
{
name: 'id',
positional: true,
required: true,
help: 'Full https://yuanbao.tencent.com/chat/<agentId>/<convId> URL or "<agentId>/<convId>" pair (a UUID alone is not enough — Yuanbao requires the agent slug)',
},
],
columns: ['Role', 'Text'],
func: async (page, kwargs) => {
const { agentId, convId } = parseYuanbaoSessionId(kwargs.id);
await page.goto(`${YUANBAO_URL}chat/${agentId}/${convId}`, { waitUntil: 'load', settleMs: 2500 });
await page.wait(2);
if (await hasLoginGate(page)) {
throw authRequired('Yuanbao opened a login gate when navigating to the conversation.');
}
// Poll up to ~20s for the transcript to render. The page shell loads
// before history is fetched, so a fixed wait races the empty render.
let bubbles = [];
const POLL_DEADLINE_MS = 20_000;
const POLL_INTERVAL_S = 1;
const startedAt = Date.now();
while (Date.now() - startedAt < POLL_DEADLINE_MS) {
bubbles = await getYuanbaoMessageBubbles(page);
if (bubbles.length > 0) break;
await page.wait(POLL_INTERVAL_S);
}
if (!bubbles.length) {
throw new EmptyResultError(
'yuanbao detail',
`No visible messages found for conversation ${agentId}/${convId}. Verify the IDs are correct and that the session belongs to the current login.`,View on GitHub (pinned to 49907e53dc)
Solutions
- Log into Yuanbao in the automation browser profile, then retry the detail command
- Clear Yuanbao cookies and perform a fresh login so deep links resolve to the transcript
- Confirm the convId/agentId belong to the logged-in account (parseYuanbaoSessionId only validates format)
- Check whether the conversation is private/deleted — gates can appear for inaccessible conversations
Example fix
// before: navigating without ensuring login
await page.goto(convUrl, { waitUntil: 'load' });
// after: catch auth error and re-login
try {
const conv = await yuanbaoDetail(id);
} catch (e) {
if (e.code === 'AUTH_REQUIRED') { await yuanbaoLogin(); return yuanbaoDetail(id); }
throw e;
} Defensive patterns
Strategy: try-catch
Validate before calling
import { hasLoginGate } from './yuanbao/page.js';
await page.goto(convUrl, { waitUntil: 'load' });
if (await hasLoginGate(page)) { await yuanbaoLogin(page); } Type guard
function isValidYuanbaoSessionId(id) {
return typeof id === 'string' && /^(agent-)?[\w-]+\/[\w-]+$/.test(id);
} Try / catch
try {
return await yuanbaoDetail(id);
} catch (e) {
if (e.code === 'AUTH_REQUIRED') { await yuanbaoLogin(page); return yuanbaoDetail(id); }
throw e;
} Prevention
- Ensure the browser profile is logged in before deep-link navigation
- Verify the conversation id belongs to the authenticated account
- Re-login when cookies age out; deep links require full auth
- Catch AUTH_REQUIRED around all yuanbao commands and centralize re-login logic
When it happens
Trigger: Running the yuanbao detail command when, after page.goto to YUANBAO_URL chat/<agentId>/<convId>, hasLoginGate(page) returns true.
Common situations: Shared/exported session id whose cookies belong to a logged-out browser; expired session cookies; conversation belonging to an account that must log in to view history; Yuanbao requiring login for all deep links.
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/5c7f1244dfdecf94.
Report an issue: GitHub.