{"record":{"id":"3a8b9e6ce744efdd","repo":"jackwener/OpenCLI","slug":"label-click-failed","errorCode":null,"errorMessage":"${label} click failed","messagePattern":"(.+?) click failed","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/antigravity/audit-extras.js","lineNumber":85,"sourceCode":"// -------- react --------\ncli({\n    site: 'antigravity',\n    name: 'react',\n    access: 'write',\n    description: 'Click \"Good response\" or \"Bad response\" on the LAST assistant message.',\n    domain: '127.0.0.1',\n    strategy: Strategy.UI,\n    browser: true,\n    args: [\n        { name: 'kind', positional: true, required: true, help: 'good or bad' },\n    ],\n    columns: ['Status', 'Reaction'],\n    func: async (page, kwargs) => {\n        const kind = String(kwargs?.kind || '').trim().toLowerCase();\n        if (kind !== 'good' && kind !== 'bad') throw new ArgumentError('kind', 'must be \"good\" or \"bad\"');\n        const label = kind === 'good' ? 'Good response' : 'Bad response';\n        const res = unwrapEvaluateResult(await page.evaluate(clickLastScript([`button[aria-label=\"${label}\"]`])));\n        if (!res?.ok) throw new CommandExecutionError(res?.reason || `${label} click failed`, '');\n        return [{ Status: 'clicked', Reaction: kind }];\n    },\n});\n\n// -------- copy-message --------\ncli({\n    site: 'antigravity',\n    name: 'copy-message',\n    access: 'write',\n    description: 'Return the text of the last assistant message (best-effort: walks up from the last visible Copy button).',\n    domain: '127.0.0.1',\n    strategy: Strategy.UI,\n    browser: true,\n    args: [\n        { name: 'click-button', type: 'boolean', default: false, help: 'Also click the in-UI Copy button' },\n    ],\n    columns: ['Field', 'Value'],\n    func: async (page, kwargs) => {","sourceCodeStart":67,"sourceCodeEnd":103,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/antigravity/audit-extras.js#L67-L103","documentation":"CommandExecutionError is thrown when the in-page script that clicks the last 'Good response'/'Bad response' button reports `ok: false` (or returns nothing usable after unwrapEvaluateResult). The fallback message `${label} click failed` is used when the page-side script did not supply a `reason`. This means the argument was valid but the DOM interaction failed — the button was not found or the click could not be performed.","triggerScenarios":"page.evaluate(clickLastScript(['button[aria-label=\"Good response\"]'])) returns { ok: false } or null: no button with that exact aria-label exists, the button is disabled/hidden, the page is still loading, or the evaluate was interrupted by navigation.","commonSituations":"Antigravity UI updated and the aria-label changed; no assistant reply is on screen yet so no reaction buttons were rendered; the chat is inside an iframe the script cannot reach; slow network leaves the reply unrendered when the command runs.","solutions":["Ensure an assistant reply is visible in the Antigravity window before running the command.","Re-run after the page fully loads, or add a wait before invoking the command.","Inspect the current aria-label on the reaction buttons and update the selector if the UI changed.","Check for iframe/embedded-document structures that page.evaluate cannot reach, and target the right frame.","Retry once — transient re-renders can unmount the button between selector resolution and click."],"exampleFix":"// before\nawait runCmd('antigravity react good');\n\n// after\nawait page.wait(1.0); // let the assistant reply render\nawait runCmd('antigravity react good');","handlingStrategy":"retry","validationCode":"// Best-effort pre-check: ensure a reaction button exists before invoking\nconst hasButton = await page.evaluate(\n  \"!!document.querySelector('button[aria-label=\\\"Good response\\\"], button[aria-label=\\\"Bad response\\\"]')\"\n);\nif (!hasButton) throw new Error('No reaction buttons rendered — wait for the assistant reply.');","typeGuard":"function isClickOk(res) {\n  return res != null && typeof res === 'object' && res.ok === true && typeof res.sel === 'string';\n}","tryCatchPattern":"try {\n  await runCmd('antigravity react good');\n} catch (e) {\n  if (e.code === 'EXEC' && /click failed/i.test(e.message)) {\n    await sleep(1500);\n    await runCmd('antigravity react good'); // one retry after re-render\n  } else throw e;\n}","preventionTips":["Wait for the assistant reply to finish streaming before reacting.","Pin/verify aria-labels after every Antigravity update.","Add a short settle delay between page actions in automation scripts.","Prefer checking button existence in-page before clicking."],"tags":["dom-click","selector-not-found","browser-automation"],"backgroundTag":"element-click-failed","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}