jackwener/OpenCLI · error · Error

Could not find Antigravity input box

Error message

Could not find Antigravity input box

What it means

Thrown inside an in-page evaluate() when the DOM element with id 'antigravity.agentSidePanelInputBox' exists but contains no Lexical rich-text editor child ([data-lexical-editor="true"]). The CLI types prompts into Antigravity's sidebar input via document.execCommand, which requires the actual Lexical editor node, not just its container.

Source

Thrown at clis/antigravity/send.js:24

    description: 'Send a message to Antigravity AI via the internal Lexical editor',
    domain: 'localhost',
    strategy: Strategy.UI,
    browser: true,
    args: [
        { name: 'message', help: 'The message text to send', required: true, positional: true }
    ],
    columns: ['Status', 'Message'],
    func: async (page, kwargs) => {
        const text = kwargs.message;
        // We use evaluate to focus and insert text because Lexical editors maintain
        // absolute control over their DOM and don't respond to raw node.textContent.
        // document.execCommand simulates a native paste/typing action perfectly.
        await page.evaluate(`
      async () => {
        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');
        
        editor.focus();
        document.execCommand('insertText', false, ${JSON.stringify(text)});
      }
    `);
        // Wait for the React/Lexical state to flush the new input
        await page.wait(0.5);
        // Press Enter to submit the message
        await page.pressKey('Enter');
        return [{ Status: 'Sent successfully', Message: text }];
    },
});

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Add a wait/poll for the [data-lexical-editor="true"] element before typing (e.g. waitForSelector('#antigravity.agentSidePanelInputBox [data-lexical-editor="true"]'))
  2. Retake or reopen the Antigravity side panel so the editor mounts, then retry
  3. Update the selector to match the current Antigravity DOM if the editor no longer uses data-lexical-editor
  4. Retry send with a short backoff to allow async editor initialization

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 });
Defensive patterns

Strategy: retry

Validate before calling

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

Type guard

function hasLexicalEditor(el) {
  return el instanceof Element && el.querySelector('[data-lexical-editor="true"]') !== null;
}

Try / catch

try {
  await sendPrompt(page, text);
} catch (err) {
  if (err.message.includes('Could not find Antigravity input box')) {
    await sleep(1500);
    await sendPrompt(page, text); // retry once after editor mounts
  } else throw err;
}

Prevention

When it happens

Trigger: page.evaluate in clis/antigravity/send.js runs, the #antigravity.agentSidePanelInputBox container is present (so the first check passed) but querySelector('[data-lexical-editor="true"]') returns null.

Common situations: Antigravity UI version changed the input implementation (no longer Lexical); the panel rendered but the editor is lazy-mounted and not yet initialized; the container exists as a hidden/skeleton placeholder during panel loading; the send was attempted immediately after opening the side panel before React finished mounting the editor.

Related errors


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