jackwener/OpenCLI · error · EmptyResultError
antigravity copy-message
Error message
antigravity copy-message
What it means
EmptyResultError (src/errors.ts:145, code 'EMPTY_RESULT') is thrown by 'antigravity copy-message' when the in-page scrape of Copy buttons returns no data — meaning no Copy buttons were found on screen. The first constructor argument is the command name, so the message reads 'antigravity copy-message returned no data'; the hint tells you to make sure an assistant reply is visible. It signals the page state did not match what the command expects.
Source
Thrown at clis/antigravity/audit-extras.js:121
func: async (page, kwargs) => {
const data = unwrapEvaluateResult(await page.evaluate(`(() => {
const isVis = (el) => { const r = el.getBoundingClientRect(); return r.width > 1 && r.height > 1; };
// Antigravity has both "Copy" (message) and "Copy code" (code block) buttons.
// We want the bottom-of-message Copy, not the code-block Copy.
const copies = Array.from(document.querySelectorAll('button[aria-label="Copy"]')).filter(isVis);
if (!copies.length) return null;
const lastCopy = copies[copies.length - 1];
let container = lastCopy;
let best = '';
for (let i = 0; i < 8 && container.parentElement; i++) {
container = container.parentElement;
const txt = (container.innerText || '').trim();
if (txt.length > best.length) best = txt;
if (best.length > 200) break;
}
return { text: best };
})()`));
if (!data) throw new EmptyResultError('antigravity copy-message', 'No Copy buttons visible — make sure an assistant reply is on screen.');
if (kwargs?.['click-button'] === true || kwargs?.['click-button'] === 'true') {
const clickResult = unwrapEvaluateResult(await page.evaluate(clickLastScript(['button[aria-label="Copy"]'])));
if (!clickResult?.ok) {
throw new CommandExecutionError(clickResult?.reason || 'Copy button click failed', '');
}
}
return [
{ Field: 'Length', Value: String((data.text || '').length) + ' chars' },
{ Field: 'ClipboardClicked', Value: (kwargs?.['click-button'] === true || kwargs?.['click-button'] === 'true') ? 'yes' : 'no' },
{ Field: 'Text', Value: data.text || '' },
];
},
});
// -------- copy-code --------
cli({
site: 'antigravity',
name: 'copy-code',View on GitHub (pinned to 49907e53dc)
Solutions
- Wait until an assistant reply is fully rendered (streaming finished) and run the command again.
- Verify you are attached to a conversation with at least one assistant message.
- Log in to Antigravity if the chat UI did not load.
- If Copy buttons exist but the command still fails, the DOM structure changed — update the scrape selector in audit-extras.js.
Example fix
// before antigravity copy-message # run immediately after sending a prompt // after # wait for the assistant reply to finish rendering, then: antigravity copy-message --click-button
Defensive patterns
Strategy: validation
Validate before calling
// Pre-check that a Copy button is present before invoking copy-message
const hasCopy = await page.evaluate("!!document.querySelector('button[aria-label=\"Copy\"]')");
if (!hasCopy) throw new Error('No assistant reply with Copy button on screen.'); Type guard
function hasScrapedText(data) {
return data != null && typeof data === 'object' && typeof data.text === 'string' && data.text.length > 0;
} Try / catch
try {
const rows = await runCmd('antigravity copy-message');
} catch (e) {
if (e.code === 'EMPTY_RESULT') {
console.error('No assistant reply visible — wait for streaming to finish, then retry.');
} else throw e;
} Prevention
- Only run copy-message when an assistant reply is fully rendered.
- Check login state — the chat UI must render for the scrape to find buttons.
- Treat EMPTY_RESULT as a page-state signal, not a code bug.
- Re-check selectors after Antigravity UI updates.
When it happens
Trigger: Running `antigravity copy-message` when no assistant reply (and therefore no Copy buttons) is rendered; the scrape script's loop finds no Copy button containers, returns null/empty after unwrapEvaluateResult, and `if (!data)` fires.
Common situations: Invoking the command on a fresh/empty conversation; the assistant is still streaming so buttons have not appeared; the user is not logged in and the chat UI never rendered; a UI redesign renamed or removed the Copy button.
Related errors
- antigravity copy-code
- Failed to export generated ChatGPT image assets
- chatgpt project-list
- chatgpt read
- No Claude response appeared within ${timeoutSeconds}s. Re-ru
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/9ef0131917b48239.
Report an issue: GitHub.