{"record":{"id":"45461171f2d68fc0","repo":"jackwener/OpenCLI","slug":"sidebar-toggle-failed","errorCode":null,"errorMessage":"sidebar-toggle failed","messagePattern":"sidebar-toggle failed","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/antigravity/audit-extras.js","lineNumber":210,"sourceCode":"        await page.wait(0.6);\n        return [{ Status: `clicked via ${res.sel}` }];\n    },\n});\n\n// -------- sidebar-toggle --------\ncli({\n    site: 'antigravity',\n    name: 'sidebar-toggle',\n    access: 'write',\n    description: 'Click Toggle Sidebar (collapses/expands the Antigravity sidebar).',\n    domain: '127.0.0.1',\n    strategy: Strategy.UI,\n    browser: true,\n    args: [],\n    columns: ['Status'],\n    func: async (page) => {\n        const res = unwrapEvaluateResult(await page.evaluate(clickFirstScript(['button[aria-label=\"Toggle Sidebar\"]'])));\n        if (!res?.ok) throw new CommandExecutionError(res?.reason || 'sidebar-toggle failed', '');\n        return [{ Status: 'toggled' }];\n    },\n});\n\n// -------- nav --------\ncli({\n    site: 'antigravity',\n    name: 'nav',\n    access: 'write',\n    description: 'Click Go Back or Go Forward (Antigravity in-app history).',\n    domain: '127.0.0.1',\n    strategy: Strategy.UI,\n    browser: true,\n    args: [\n        { name: 'direction', positional: true, required: true, help: 'back or forward' },\n    ],\n    columns: ['Status'],\n    func: async (page, kwargs) => {","sourceCodeStart":192,"sourceCodeEnd":228,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/antigravity/audit-extras.js#L192-L228","documentation":"CommandExecutionError thrown by 'sidebar-toggle' when clicking `button[aria-label=\"Toggle Sidebar\"]` fails (`ok: false` from clickFirstScript, or a null result). The fallback message 'sidebar-toggle failed' is used when no page-side `reason` is available. The command's only job is that one click, so any DOM mismatch or timing issue surfaces as this error.","triggerScenarios":"`page.evaluate(clickFirstScript(['button[aria-label=\"Toggle Sidebar\"]']))` returns { ok: false }: the sidebar toggle button is absent (narrow window hides it), the aria-label changed, or the page was mid-navigation during evaluate.","commonSituations":"Antigravity update renames the toggle ('Collapse sidebar', icon-only button without label); the command runs on a window size or layout where the sidebar toggle isn't rendered; running before app initialization completes.","solutions":["Re-run after the app fully renders; add a small wait before the command.","Inspect the actual toggle button's aria-label in devtools and update the selector in audit-extras.js.","Widen the browser window if the toggle is hidden at narrow widths.","Verify the chat UI rendered at all (log in if needed)."],"exampleFix":"// before\nclickFirstScript(['button[aria-label=\"Toggle Sidebar\"]'])\n\n// after\nclickFirstScript(['button[aria-label=\"Toggle Sidebar\"]', 'button[aria-label=\"Collapse sidebar\"]'])","handlingStrategy":"retry","validationCode":"const hasToggle = await page.evaluate(\"!!document.querySelector('button[aria-label=\\\"Toggle Sidebar\\\"]')\");\nif (!hasToggle) throw new Error('Sidebar toggle not present (window too narrow or UI changed).');","typeGuard":"function isToggleOk(res) {\n  return res != null && typeof res === 'object' && res.ok === true;\n}","tryCatchPattern":"try {\n  await runCmd('antigravity sidebar-toggle');\n} catch (e) {\n  if (e.code === 'EXEC' && /sidebar-toggle failed/i.test(e.message)) {\n    await sleep(1200);\n    await runCmd('antigravity sidebar-toggle'); // retry after render settles\n  } else throw e;\n}","preventionTips":["Use a window size where the sidebar toggle is rendered.","Re-check the toggle's aria-label after each app update.","Insert a settle delay before chrome-manipulating commands.","Confirm the chat UI fully mounted before running UI commands."],"tags":["dom-click","selector-not-found","ui-automation"],"backgroundTag":"element-click-failed","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}