jackwener/OpenCLI · error · CommandExecutionError
sidebar-toggle failed
Error message
sidebar-toggle failed
What it means
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.
Source
Thrown at clis/antigravity/audit-extras.js:210
await page.wait(0.6);
return [{ Status: `clicked via ${res.sel}` }];
},
});
// -------- sidebar-toggle --------
cli({
site: 'antigravity',
name: 'sidebar-toggle',
access: 'write',
description: 'Click Toggle Sidebar (collapses/expands the Antigravity sidebar).',
domain: '127.0.0.1',
strategy: Strategy.UI,
browser: true,
args: [],
columns: ['Status'],
func: async (page) => {
const res = unwrapEvaluateResult(await page.evaluate(clickFirstScript(['button[aria-label="Toggle Sidebar"]'])));
if (!res?.ok) throw new CommandExecutionError(res?.reason || 'sidebar-toggle failed', '');
return [{ Status: 'toggled' }];
},
});
// -------- nav --------
cli({
site: 'antigravity',
name: 'nav',
access: 'write',
description: 'Click Go Back or Go Forward (Antigravity in-app history).',
domain: '127.0.0.1',
strategy: Strategy.UI,
browser: true,
args: [
{ name: 'direction', positional: true, required: true, help: 'back or forward' },
],
columns: ['Status'],
func: async (page, kwargs) => {View on GitHub (pinned to 49907e53dc)
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).
Example fix
// before clickFirstScript(['button[aria-label="Toggle Sidebar"]']) // after clickFirstScript(['button[aria-label="Toggle Sidebar"]', 'button[aria-label="Collapse sidebar"]'])
Defensive patterns
Strategy: retry
Validate before calling
const hasToggle = await page.evaluate("!!document.querySelector('button[aria-label=\"Toggle Sidebar\"]')");
if (!hasToggle) throw new Error('Sidebar toggle not present (window too narrow or UI changed).'); Type guard
function isToggleOk(res) {
return res != null && typeof res === 'object' && res.ok === true;
} Try / catch
try {
await runCmd('antigravity sidebar-toggle');
} catch (e) {
if (e.code === 'EXEC' && /sidebar-toggle failed/i.test(e.message)) {
await sleep(1200);
await runCmd('antigravity sidebar-toggle'); // retry after render settles
} else throw e;
} Prevention
- 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.
When it happens
Trigger: `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.
Common situations: 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.
Related errors
- settings click failed
- ${label} click failed
- Copy button click failed
- Prompt Enhance button not found
- Open Editor button not found
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/45461171f2d68fc0.
Report an issue: GitHub.