jackwener/OpenCLI · error · Error

Could not find Antigravity input box

Error message

Could not find Antigravity input box

What it means

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.

Source

Thrown at clis/antigravity/serve.js:255

      (() => {
        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);
    await bridge.send('Input.dispatchKeyEvent', { type: 'keyUp', key: 'Enter', code: 'Enter', windowsVirtualKeyCode: 13, nativeVirtualKeyCode: 13 });
}

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Wait for the editor selector inside the container before computing the rect
  2. Retake/reopen the panel to force editor mount
  3. Update selectors to match current Antigravity markup (including shadow DOM/iframe traversal if needed)
  4. Retry with backoff to let React/Lexical hydrate

Example fix

// before
const editor = container.querySelector('[data-lexical-editor="true"]');
if (!editor) throw new Error('Could not find Antigravity input box');
// after
const editor = await page.waitForSelector('#antigravity.agentSidePanelInputBox [data-lexical-editor="true"]', { timeout: 10000 });
if (!editor) throw new Error('Could not find Antigravity input box');
Defensive patterns

Strategy: retry

Validate before calling

const editorExists = await page.evaluate(() =>
  !!document.querySelector('#antigravity.agentSidePanelInputBox [data-lexical-editor="true"]'));
if (!editorExists) throw new Error('Lexical editor not mounted inside input container');

Type guard

function hasEditorRect(el) {
  const editor = el?.querySelector?.('[data-lexical-editor="true"]');
  return editor instanceof Element && editor.getBoundingClientRect().width > 0;
}

Try / catch

try {
  await sendMessage(message);
} catch (err) {
  if (err.message.includes('Could not find Antigravity input box')) {
    await sleep(1000); // allow React/Lexical hydration
    await sendMessage(message);
  } else throw err;
}

Prevention

When it happens

Trigger: Rect-extraction evaluate finds the container, then querySelector('[data-lexical-editor="true"]') returns null.

Common situations: 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.

Related errors


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