{"record":{"id":"bae0e057145cea5a","repo":"jackwener/OpenCLI","slug":"could-not-find-antigravity-input-box-bae0e0","errorCode":null,"errorMessage":"Could not find Antigravity input box","messagePattern":"Could not find Antigravity input box","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"clis/antigravity/serve.js","lineNumber":255,"sourceCode":"      (() => {\n        const container = document.getElementById('antigravity.agentSidePanelInputBox');\n        const editor = container?.querySelector('[data-lexical-editor=\"true\"]');\n        if (!editor) throw new Error('Could not find input box');\n        editor.focus();\n        document.execCommand('insertText', false, ${JSON.stringify(message)});\n      })()\n    `);\n        await sleep(500);\n        await page.pressKey('Enter');\n        return;\n    }\n    // Get the bounding box of the Lexical editor for a physical mouse click\n    const rect = await page.evaluate(`\n    (() => {\n      const container = document.getElementById('antigravity.agentSidePanelInputBox');\n      if (!container) throw new Error('Could not find antigravity.agentSidePanelInputBox');\n      const editor = container.querySelector('[data-lexical-editor=\"true\"]');\n      if (!editor) throw new Error('Could not find Antigravity input box');\n      const r = editor.getBoundingClientRect();\n      return JSON.stringify({ x: r.left + r.width / 2, y: r.top + r.height / 2 });\n    })()\n  `);\n    const { x, y } = JSON.parse(String(rect));\n    // Physical mouse click to give the element real browser focus\n    await bridge.send('Input.dispatchMouseEvent', { type: 'mousePressed', x, y, button: 'left', clickCount: 1 });\n    await sleep(50);\n    await bridge.send('Input.dispatchMouseEvent', { type: 'mouseReleased', x, y, button: 'left', clickCount: 1 });\n    await sleep(200);\n    // Inject text at the CDP level (no deprecated execCommand)\n    await bridge.send('Input.insertText', { text: message });\n    await sleep(300);\n    // Send Enter via native CDP key event\n    await bridge.send('Input.dispatchKeyEvent', { type: 'keyDown', key: 'Enter', code: 'Enter', windowsVirtualKeyCode: 13, nativeVirtualKeyCode: 13 });\n    await sleep(50);\n    await bridge.send('Input.dispatchKeyEvent', { type: 'keyUp', key: 'Enter', code: 'Enter', windowsVirtualKeyCode: 13, nativeVirtualKeyCode: 13 });\n}","sourceCodeStart":237,"sourceCodeEnd":273,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/antigravity/serve.js#L237-L273","documentation":"Companion error to 242 in the same bounding-box evaluate: the input container was found but it holds no [data-lexical-editor=\"true\"] element, so the editor rect for the mouse-click coordinates cannot be computed.","triggerScenarios":"Rect-extraction evaluate finds the container, then querySelector('[data-lexical-editor=\"true\"]') returns null.","commonSituations":"Panel rendered a placeholder/skeleton without the editor yet; Antigravity switched away from Lexical in an update; editor is inside a shadow root or iframe that querySelector can't reach.","solutions":["Wait for the editor selector inside the container before computing the rect","Retake/reopen the panel to force editor mount","Update selectors to match current Antigravity markup (including shadow DOM/iframe traversal if needed)","Retry with backoff to let React/Lexical hydrate"],"exampleFix":"// before\nconst editor = container.querySelector('[data-lexical-editor=\"true\"]');\nif (!editor) throw new Error('Could not find Antigravity input box');\n// after\nconst editor = await page.waitForSelector('#antigravity.agentSidePanelInputBox [data-lexical-editor=\"true\"]', { timeout: 10000 });\nif (!editor) throw new Error('Could not find Antigravity input box');","handlingStrategy":"retry","validationCode":"const editorExists = await page.evaluate(() =>\n  !!document.querySelector('#antigravity.agentSidePanelInputBox [data-lexical-editor=\"true\"]'));\nif (!editorExists) throw new Error('Lexical editor not mounted inside input container');","typeGuard":"function hasEditorRect(el) {\n  const editor = el?.querySelector?.('[data-lexical-editor=\"true\"]');\n  return editor instanceof Element && editor.getBoundingClientRect().width > 0;\n}","tryCatchPattern":"try {\n  await sendMessage(message);\n} catch (err) {\n  if (err.message.includes('Could not find Antigravity input box')) {\n    await sleep(1000); // allow React/Lexical hydration\n    await sendMessage(message);\n  } else throw err;\n}","preventionTips":["Wait for editor hydration before computing click coordinates","Retry with backoff after panel opens","Verify markup after Antigravity updates","Check visibility (width/height > 0), not just existence"],"tags":["dom","selector","automation","antigravity"],"backgroundTag":"dom-element-not-found","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}