{"record":{"id":"9869d3d6e9a9f92a","repo":"jackwener/OpenCLI","slug":"signout-svg-not-found","errorCode":null,"errorMessage":"SignOut svg not found","messagePattern":"SignOut svg not found","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/kimi/audit-extras.js","lineNumber":61,"sourceCode":"    browser: true,\n    siteSession: 'persistent',\n    navigateBefore: false,\n    args: [\n        { name: 'yes', type: 'boolean', default: false, help: 'Actually sign out (default: dry-run)' },\n    ],\n    columns: AUDIT_EXTRA_COLUMNS,\n    func: async (page, kwargs) => {\n        const yes = kwargs?.yes === true || kwargs?.yes === 'true' || kwargs?.yes === '1';\n        if (!yes) {\n            return [{ Status: 'dry-run — pass --yes to actually sign out' }];\n        }\n        const url = await page.evaluate('window.location.href');\n        if (!String(url || '').includes('/settings')) {\n            await page.goto(`${KIMI_URL}settings`);\n            await page.wait(1.5);\n        }\n        const res = await page.evaluate(clickBySvgNameScript('SignOut'));\n        if (!res?.ok) throw new CommandExecutionError(res?.reason || 'SignOut svg not found', '');\n        await page.wait(1);\n        return [{ Status: 'signed-out' }];\n    },\n});\n\n// -------- upgrade --------\ncli({\n    site: 'kimi',\n    name: 'upgrade',\n    access: 'write',\n    description: 'Click the \"Upgrade\" button (or 升级会员) in the Kimi sidebar — opens the membership/upgrade page or dialog.',\n    domain: KIMI_DOMAIN,\n    strategy: Strategy.COOKIE,\n    browser: true,\n    siteSession: 'persistent',\n    navigateBefore: false,\n    args: [],\n    columns: AUDIT_EXTRA_COLUMNS,","sourceCodeStart":43,"sourceCodeEnd":79,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/kimi/audit-extras.js#L43-L79","documentation":"The kimi sign-out command clicks an SVG named 'SignOut' on the Kimi /settings page via clickBySvgNameScript. If the in-page script cannot find that SVG (or its clickable ancestor), it returns {ok:false} with a reason, and the command throws CommandExecutionError with that reason or the fallback 'SignOut svg not found'.","triggerScenarios":"Running `kimi sign-out --yes` when the SignOut svg does not exist in the /settings DOM: the account already signed out, Kimi renamed/redesigned the icon, the settings page failed to fully render within the 1.5s wait, or the page redirected away from /settings.","commonSituations":"Session already expired so the settings page shows a login screen instead; Kimi UI update changed svg name='SignOut'; slow network made the 1.5s page.wait insufficient; headless browser blocks rendering the sidebar.","solutions":["Check whether you are actually still signed in — if already signed out, the error is expected and no action is needed","Increase the wait/retry: re-run the command so the settings page has more time to load","Open kimi.com/settings in a browser and inspect whether an svg[name='SignOut'] still exists — if Kimi renamed it, update the selector in clickBySvgNameScript usage","Verify the session cookie is valid and the page is not redirecting to a login URL"],"exampleFix":"// before\nawait page.wait(1.5);\nconst res = await page.evaluate(clickBySvgNameScript('SignOut'));\n// after\nawait page.wait(3); // give SPA more time to render\nlet res = await page.evaluate(clickBySvgNameScript('SignOut'));\nif (!res?.ok) { await page.wait(2); res = await page.evaluate(clickBySvgNameScript('SignOut')); }","handlingStrategy":"try-catch","validationCode":"const url = await page.evaluate('window.location.href');\nconst hasSvg = await page.evaluate(`!!document.querySelector(\"svg[name='SignOut']\")`);\nif (!String(url).includes('/settings') || !hasSvg) throw new Error('SignOut unavailable: not on settings or already signed out');","typeGuard":"function isClickResult(res) { return res != null && typeof res === 'object' && typeof res.ok === 'boolean'; }","tryCatchPattern":"try {\n  await runCli('kimi sign-out', { yes: true });\n} catch (e) {\n  if (/SignOut svg not found|signed out/i.test(e.message)) console.warn('Nothing to sign out of — ignoring');\n  else throw e;\n}","preventionTips":["Check login state before attempting sign-out","Pin/review selectors after Kimi UI updates","Allow generous page-load waits before DOM queries","Run sign-out against a visible browser first to confirm the icon exists"],"tags":["browser-automation","dom-selector","ui-change"],"backgroundTag":"dom-element-not-found","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}