jackwener/OpenCLI · error · Error
Could not find antigravity.agentSidePanelInputBox
Error message
Could not find antigravity.agentSidePanelInputBox
What it means
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.
Source
Thrown at clis/antigravity/serve.js:253
// Fallback: use JS-based approach
await page.evaluate(`
(() => {
const container = document.getElementById('antigravity.agentSidePanelInputBox');
const editor = container?.querySelector('[data-lexical-editor="true"]');
if (!editor) throw new Error('Could not find input box');
editor.focus();
document.execCommand('insertText', false, ${JSON.stringify(message)});
})()
`);
await sleep(500);
await page.pressKey('Enter');
return;
}
// Get the bounding box of the Lexical editor for a physical mouse click
const rect = await page.evaluate(`
(() => {
const container = document.getElementById('antigravity.agentSidePanelInputBox');
if (!container) throw new Error('Could not find antigravity.agentSidePanelInputBox');
const editor = container.querySelector('[data-lexical-editor="true"]');
if (!editor) throw new Error('Could not find Antigravity input box');
const r = editor.getBoundingClientRect();
return JSON.stringify({ x: r.left + r.width / 2, y: r.top + r.height / 2 });
})()
`);
const { x, y } = JSON.parse(String(rect));
// Physical mouse click to give the element real browser focus
await bridge.send('Input.dispatchMouseEvent', { type: 'mousePressed', x, y, button: 'left', clickCount: 1 });
await sleep(50);
await bridge.send('Input.dispatchMouseEvent', { type: 'mouseReleased', x, y, button: 'left', clickCount: 1 });
await sleep(200);
// Inject text at the CDP level (no deprecated execCommand)
await bridge.send('Input.insertText', { text: message });
await sleep(300);
// Send Enter via native CDP key event
await bridge.send('Input.dispatchKeyEvent', { type: 'keyDown', key: 'Enter', code: 'Enter', windowsVirtualKeyCode: 13, nativeVirtualKeyCode: 13 });
await sleep(50);View on GitHub (pinned to 49907e53dc)
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
Example fix
// before
const container = document.getElementById('antigravity.agentSidePanelInputBox');
if (!container) throw new Error('Could not find antigravity.agentSidePanelInputBox');
// after
await page.waitForSelector('#antigravity.agentSidePanelInputBox', { timeout: 10000 });
const container = document.getElementById('antigravity.agentSidePanelInputBox'); Defensive patterns
Strategy: validation
Validate before calling
const containerExists = await page.evaluate(() => !!document.getElementById('antigravity.agentSidePanelInputBox'));
if (!containerExists) throw new Error('Open the Antigravity side panel first'); Type guard
function hasInputContainer(doc) {
return doc.getElementById('antigravity.agentSidePanelInputBox') instanceof Element;
} Try / catch
try {
await sendMessage(message);
} catch (err) {
if (err.message.includes('Could not find antigravity.agentSidePanelInputBox')) {
await openSidePanel();
await sendMessage(message);
} else throw err;
} Prevention
- 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
When it happens
Trigger: page.evaluate runs the rect-extraction IIFE and document.getElementById('antigravity.agentSidePanelInputBox') returns null.
Common situations: 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.
Related errors
- Could not find Antigravity input box
- Could not find input box
- Could not find Antigravity input box
- Timeout waiting for Antigravity reply after ${timeout / 1000
- LinkedIn connect blocked: ${opened?.reason || 'connect_contr
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/2b8170d13f125573.
Report an issue: GitHub.