{"record":{"id":"943adff954f6c225","repo":"jackwener/OpenCLI","slug":"auth-required-943adf","errorCode":"AUTH_REQUIRED","errorMessage":"Yuanbao opened a login gate when reading the sidebar.","messagePattern":"Yuanbao opened a login gate when reading the sidebar\\.","errorType":"exception","errorClass":"AuthRequiredError","httpStatus":null,"severity":"error","filePath":"clis/yuanbao/history.js","lineNumber":33,"sourceCode":"    access: 'read',\n    description: 'List recent Yuanbao conversations from the sidebar (requires login)',\n    domain: YUANBAO_DOMAIN,\n    strategy: Strategy.COOKIE,\n    browser: true,\n    siteSession: 'persistent',\n    navigateBefore: false,\n    args: [\n        { name: 'limit', type: 'int', default: 20, help: 'Max conversations to list (sidebar virtual scroll caps actual count)' },\n    ],\n    columns: ['Index', 'Title', 'AgentId', 'SessionId', 'Url'],\n    func: async (page, kwargs) => {\n        const limit = Number(kwargs.limit ?? 20);\n        if (!Number.isInteger(limit) || limit <= 0) {\n            throw new ArgumentError('limit', 'must be a positive integer');\n        }\n        await ensureYuanbaoPage(page);\n        if (await hasLoginGate(page)) {\n            throw authRequired('Yuanbao opened a login gate when reading the sidebar.');\n        }\n        await page.wait(1.5);\n        const sessions = await getYuanbaoSessionList(page, limit);\n        if (!sessions.length) {\n            throw new EmptyResultError(\n                'yuanbao history',\n                'No Yuanbao conversations found in the sidebar. Either the account is logged out, the sidebar is collapsed, or the user truly has no chat history yet.',\n            );\n        }\n        return sessions.map((s, i) => ({\n            Index: i + 1,\n            Title: s.title || '(untitled)',\n            AgentId: s.agentId,\n            SessionId: s.cid,\n            Url: `${YUANBAO_URL}chat/${s.agentId}/${s.cid}`,\n        }));\n    },\n});","sourceCodeStart":15,"sourceCodeEnd":51,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/yuanbao/history.js#L15-L51","documentation":"The Yuanbao CLI history command detected Tencent Yuanbao's login gate (login wall / not-authenticated overlay) on the automation page before reading the sidebar session list. The library throws AUTH_REQUIRED because the operation cannot proceed without an authenticated Yuanbao session. It is raised in the command function for `yuanbao history` after ensureYuanbaoPage and hasLoginGate detection.","triggerScenarios":"Running the `yuanbao history` command when hasLoginGate(page) returns true — i.e., the browser page redirected to or displays Yuanbao's login gate instead of the authenticated sidebar with the session list.","commonSituations":"Expired Yuanbao session cookies, running the CLI with a fresh browser profile that was never logged in, being logged out remotely, or cookies cleared by browser cleanup tools.","solutions":["Open the automation browser profile and log in to yuanbao.tencent.com manually, then rerun the command.","Persist the logged-in browser profile (user data dir) so cookies survive across CLI runs.","Re-check with a short retry in case the gate was a transient redirect before authentication state settled.","Verify the browser profile/daemon is attached to the account you expect, not a fresh or incognito profile."],"exampleFix":"// before: headless run with fresh profile\nawait cli.run(['yuanbao', 'history']);\n// after: reuse persisted profile and log in once\nconst browser = await launch({ userDataDir: '~/.opencli/profiles/yuanbao' });\nawait loginToYuanbao(browser); // one-time interactive login\nawait cli.run(['yuanbao', 'history']);","handlingStrategy":"try-catch","validationCode":"if (await hasLoginGate(page)) {\n  await interactiveLogin(page); // log in before invoking history\n}\nawait cli.run(['yuanbao', 'history']);","typeGuard":null,"tryCatchPattern":"try {\n  await cli.run(['yuanbao', 'history']);\n} catch (e) {\n  if (e.code === 'AUTH_REQUIRED') { await interactiveLogin(page); return cli.run(['yuanbao', 'history']); }\n  throw e;\n}","preventionTips":["Use a persisted, dedicated browser profile for Yuanbao automation.","Run a cheap authenticated pre-flight command before batch jobs.","Refresh cookies periodically; re-login proactively before long runs.","Avoid wiping browser user-data-dir in cleanup scripts."],"tags":["authentication","browser-automation","yuanbao"],"backgroundTag":"browser-login-required","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}