{"record":{"id":"2b8170d13f125573","repo":"jackwener/OpenCLI","slug":"could-not-find-antigravity-agentsidepanelinputbox-2b8170","errorCode":null,"errorMessage":"Could not find antigravity.agentSidePanelInputBox","messagePattern":"Could not find antigravity\\.agentSidePanelInputBox","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"clis/antigravity/serve.js","lineNumber":253,"sourceCode":"        // Fallback: use JS-based approach\n        await page.evaluate(`\n      (() => {\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);","sourceCodeStart":235,"sourceCodeEnd":271,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/antigravity/serve.js#L235-L271","documentation":"In serve.js sendMessage's bounding-box computation, thrown when the #antigravity.agentSidePanelInputBox element is absent from the page DOM. The code needs the container to locate the Lexical editor's center coordinates for a physical mouse click.","triggerScenarios":"page.evaluate runs the rect-extraction IIFE and document.getElementById('antigravity.agentSidePanelInputBox') returns null.","commonSituations":"Antigravity side panel never opened or was closed between requests; wrong window/tab focused (CDP page handle points at a different target); Antigravity UI update renamed the input container id; connecting before the IDE fully loaded its workbench UI.","solutions":["Open the Antigravity agent side panel before sending requests","Verify the CDP page handle points at the correct Antigravity window/target (list targets and pick the right one)","Wait for the input container to exist before computing the rect (waitForSelector)","Confirm the element id after any Antigravity update"],"exampleFix":"// before\nconst container = document.getElementById('antigravity.agentSidePanelInputBox');\nif (!container) throw new Error('Could not find antigravity.agentSidePanelInputBox');\n// after\nawait page.waitForSelector('#antigravity.agentSidePanelInputBox', { timeout: 10000 });\nconst container = document.getElementById('antigravity.agentSidePanelInputBox');","handlingStrategy":"validation","validationCode":"const containerExists = await page.evaluate(() => !!document.getElementById('antigravity.agentSidePanelInputBox'));\nif (!containerExists) throw new Error('Open the Antigravity side panel first');","typeGuard":"function hasInputContainer(doc) {\n  return doc.getElementById('antigravity.agentSidePanelInputBox') instanceof Element;\n}","tryCatchPattern":"try {\n  await sendMessage(message);\n} catch (err) {\n  if (err.message.includes('Could not find antigravity.agentSidePanelInputBox')) {\n    await openSidePanel();\n    await sendMessage(message);\n  } else throw err;\n}","preventionTips":["Always open the Antigravity agent side panel before sending","Confirm the CDP target is the Antigravity window, not another tab","Check the element id after Antigravity updates","Use waitForSelector before rect computation"],"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"}