{"record":{"id":"860cb136a815a9b8","repo":"jackwener/OpenCLI","slug":"antigravity-cookies-document-cookie-is-empty","errorCode":null,"errorMessage":"antigravity cookies: document.cookie is empty.","messagePattern":"antigravity cookies: document\\.cookie is empty\\.","errorType":"exception","errorClass":"EmptyResultError","httpStatus":null,"severity":"warning","filePath":"clis/antigravity/storage.js","lineNumber":162,"sourceCode":"            { Field: 'Value', Value: truncated ? text.slice(0, max) + '\\n...(truncated)' : text },\n        ];\n    },\n});\n\n// ====== Renderer-side: cookies ======\ncli({\n    site: 'antigravity',\n    name: 'cookies',\n    access: 'read',\n    description: 'List cookies on the Antigravity renderer (JS-visible via document.cookie).',\n    domain: '127.0.0.1',\n    strategy: Strategy.UI,\n    browser: true,\n    args: [],\n    columns: STORAGE_COLUMNS,\n    func: async (page) => {\n        const raw = unwrapEvaluateResult(await page.evaluate('document.cookie'));\n        if (!raw) throw new EmptyResultError('antigravity cookies', 'document.cookie is empty.');\n        const cookies = raw.split('; ').map((pair) => {\n            const idx = pair.indexOf('=');\n            if (idx < 0) return { name: pair, value: '' };\n            return { name: pair.slice(0, idx), value: pair.slice(idx + 1) };\n        });\n        return cookies.map((c, i) => ({\n            Index: i + 1, Name: c.name, Bytes: c.value.length,\n            Preview: c.value.slice(0, 40) + (c.value.length > 40 ? '…' : ''),\n        }));\n    },\n});\n\n// ====== Renderer-side: idb-list ======\ncli({\n    site: 'antigravity',\n    name: 'idb-list',\n    access: 'read',\n    description: 'List IndexedDB databases on the Antigravity renderer.',","sourceCodeStart":144,"sourceCodeEnd":180,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/antigravity/storage.js#L144-L180","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Interact with the app (sign in / load a workspace) so cookies get set, then re-run.","Use CDP Network.getAllCookies via a DevTools script to see HttpOnly cookies too.","Check localStorage/sessionStorage instead: `opencli antigravity storage-keys` — tokens often live there.","Verify the attached page URL origin matches the origin that sets the cookies."],"exampleFix":"// before (expecting tokens in document.cookie)\nopencli antigravity cookies\n// after\nopencli antigravity storage-keys --filter auth","handlingStrategy":"try-catch","validationCode":"// Only expect document.cookie data after the app has loaded/authenticated\nconst authed = execSync('opencli antigravity storage-keys --filter auth', {encoding:'utf8'});\nif (!authed.trim() || /is empty|No keys/.test(authed)) console.warn('renderer appears unauthenticated; cookies likely empty too');","typeGuard":"function looksAuthenticated(storageKeysOutput) {\n  return typeof storageKeysOutput === 'string' && /auth|token|session/i.test(storageKeysOutput);\n}","tryCatchPattern":"try {\n  run('opencli antigravity cookies');\n} catch (e) {\n  if (/document\\.cookie is empty/.test(e.message)) {\n    console.warn('No JS-visible cookies (all HttpOnly or none set); falling back to storage inspection');\n    run('opencli antigravity storage-keys');\n  } else throw e;\n}","preventionTips":["Remember HttpOnly cookies never appear in document.cookie — use CDP Network.getAllCookies for those.","Ensure the renderer page has loaded and authenticated before reading cookies.","Check localStorage/sessionStorage for tokens as an alternative source.","Treat empty cookies as a state issue, not a command failure."],"tags":["cookies","empty-result","browser","httponly","antigravity"],"backgroundTag":"empty-document-cookie","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}