jackwener/OpenCLI · error · CommandExecutionError

settings click failed

Error message

settings click failed

What it means

CommandExecutionError thrown by the 'settings' command when its clickFirstScript over the selectors '[data-testid="settings-button"]' and 'button[aria-label="Settings"]' reports `ok: false`. The fallback message 'settings click failed' appears when the page-side script gives no `reason`. It means the settings button could not be located or clicked in the current page state.

Source

Thrown at clis/antigravity/audit-extras.js:191

});

// -------- settings --------
cli({
    site: 'antigravity',
    name: 'settings',
    access: 'write',
    description: 'Click the Antigravity settings button (matched by data-testid="settings-button").',
    domain: '127.0.0.1',
    strategy: Strategy.UI,
    browser: true,
    args: [],
    columns: ['Status'],
    func: async (page) => {
        const res = unwrapEvaluateResult(await page.evaluate(clickFirstScript([
            '[data-testid="settings-button"]',
            'button[aria-label="Settings"]',
        ])));
        if (!res?.ok) throw new CommandExecutionError(res?.reason || 'settings click failed', '');
        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"]'])));

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Wait for the app to fully load, then re-run the command.
  2. Confirm the settings button exists in the DOM (devtools) and check its current data-testid / aria-label.
  3. Log in to Antigravity if the app shell did not render.
  4. Add the new selector to the clickFirstScript selector list in audit-extras.js.
  5. On success the command reports 'clicked via <sel>' — use that to confirm which selector worked.

Example fix

// before
clickFirstScript(['[data-testid="settings-button"]', 'button[aria-label="Settings"]'])

// after
clickFirstScript(['[data-testid="settings-button"]', 'button[aria-label="Settings"]', 'button[aria-label="Open settings"]'])
Defensive patterns

Strategy: validation

Validate before calling

const hasSettings = await page.evaluate(
  "!!document.querySelector('[data-testid=\"settings-button\"], button[aria-label=\"Settings\"]')"
);
if (!hasSettings) throw new Error('Settings button not rendered — wait for app shell to load.');

Type guard

function clickSucceeded(res) {
  return res != null && typeof res === 'object' && res.ok === true && typeof res.sel === 'string';
}

Try / catch

try {
  await runCmd('antigravity settings');
} catch (e) {
  if (e.code === 'EXEC' && /settings click failed/i.test(e.message)) {
    await sleep(1000); // allow app shell to mount
    await runCmd('antigravity settings');
  } else throw e;
}

Prevention

When it happens

Trigger: `page.evaluate(clickFirstScript([...]))` returns { ok: false } or null: neither selector matched, the button is inside a closed menu, the page hasn't finished loading, or evaluate failed (navigation, crash).

Common situations: Antigravity redesigned its settings entry point (data-testid/aria-label changed); the command runs before the app shell mounts; user not logged in so the main UI (with settings) never renders; the button is behind a hover-revealed menu.

Related errors


AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29). Data as JSON: /api/errors/1b97371a6f92635e. Report an issue: GitHub.