jackwener/OpenCLI · warning · EmptyResultError

antigravity cookies: document.cookie is empty.

Error message

antigravity cookies: document.cookie is empty.

What it means

The cookies command reads document.cookie on the Antigravity renderer via CDP and throws EmptyResultError when it comes back falsy. document.cookie only exposes non-HttpOnly cookies for the current origin, so an empty result usually means all cookies are HttpOnly or none were set for that page yet.

Source

Thrown at clis/antigravity/storage.js:162

            { Field: 'Value', Value: truncated ? text.slice(0, max) + '\n...(truncated)' : text },
        ];
    },
});

// ====== Renderer-side: cookies ======
cli({
    site: 'antigravity',
    name: 'cookies',
    access: 'read',
    description: 'List cookies on the Antigravity renderer (JS-visible via document.cookie).',
    domain: '127.0.0.1',
    strategy: Strategy.UI,
    browser: true,
    args: [],
    columns: STORAGE_COLUMNS,
    func: async (page) => {
        const raw = unwrapEvaluateResult(await page.evaluate('document.cookie'));
        if (!raw) throw new EmptyResultError('antigravity cookies', 'document.cookie is empty.');
        const cookies = raw.split('; ').map((pair) => {
            const idx = pair.indexOf('=');
            if (idx < 0) return { name: pair, value: '' };
            return { name: pair.slice(0, idx), value: pair.slice(idx + 1) };
        });
        return cookies.map((c, i) => ({
            Index: i + 1, Name: c.name, Bytes: c.value.length,
            Preview: c.value.slice(0, 40) + (c.value.length > 40 ? '…' : ''),
        }));
    },
});

// ====== Renderer-side: idb-list ======
cli({
    site: 'antigravity',
    name: 'idb-list',
    access: 'read',
    description: 'List IndexedDB databases on the Antigravity renderer.',

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Interact with the app (sign in / load a workspace) so cookies get set, then re-run.
  2. Use CDP Network.getAllCookies via a DevTools script to see HttpOnly cookies too.
  3. Check localStorage/sessionStorage instead: `opencli antigravity storage-keys` — tokens often live there.
  4. Verify the attached page URL origin matches the origin that sets the cookies.

Example fix

// before (expecting tokens in document.cookie)
opencli antigravity cookies
// after
opencli antigravity storage-keys --filter auth
Defensive patterns

Strategy: try-catch

Validate before calling

// Only expect document.cookie data after the app has loaded/authenticated
const authed = execSync('opencli antigravity storage-keys --filter auth', {encoding:'utf8'});
if (!authed.trim() || /is empty|No keys/.test(authed)) console.warn('renderer appears unauthenticated; cookies likely empty too');

Type guard

function looksAuthenticated(storageKeysOutput) {
  return typeof storageKeysOutput === 'string' && /auth|token|session/i.test(storageKeysOutput);
}

Try / catch

try {
  run('opencli antigravity cookies');
} catch (e) {
  if (/document\.cookie is empty/.test(e.message)) {
    console.warn('No JS-visible cookies (all HttpOnly or none set); falling back to storage inspection');
    run('opencli antigravity storage-keys');
  } else throw e;
}

Prevention

When it happens

Trigger: Running `opencli antigravity cookies` before the renderer has performed any authenticated request that sets a JS-visible cookie, or when every cookie is HttpOnly (invisible to document.cookie), or on a blank/about page with no cookie scope.

Common situations: Trying to inspect auth/session tokens that Antigravity stores in HttpOnly cookies or in the keychain instead of document.cookie; attaching the CDP session to a fresh window that has not navigated to the app origin.

Related errors


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