{"record":{"id":"e516189e5314f057","repo":"jackwener/OpenCLI","slug":"probe-detail-e51618","errorCode":null,"errorMessage":"${probe.detail}","messagePattern":"\\$\\{probe\\.detail\\}","errorType":"exception","errorClass":"AuthRequiredError","httpStatus":null,"severity":"error","filePath":"clis/gemini/auth.js","lineNumber":30,"sourceCode":"    throw new AuthRequiredError('gemini.google.com', 'Google session cookies (SID / SAPISID) missing');\n  }\n  await page.goto('https://gemini.google.com/app');\n  await page.wait(3);\n  const probe = await page.evaluate(`\n    (() => {\n      const a = document.querySelector('a[aria-label^=\"Google Account:\"]');\n      if (!a) {\n        return { kind: 'auth', detail: 'Gemini account link missing — not signed into Google' };\n      }\n      const label = a.getAttribute('aria-label') || '';\n      const m = label.match(/Google Account:\\\\s*([^(]+?)\\\\s*\\\\(([^)]+)\\\\)/);\n      if (!m) {\n        return { kind: 'auth', detail: 'Gemini aria-label unparseable: ' + label };\n      }\n      return { ok: true, name: m[1].trim() };\n    })()\n  `);\n  if (probe?.kind === 'auth') throw new AuthRequiredError('gemini.google.com', probe.detail);\n  if (!probe?.ok) throw new CommandExecutionError(`Unexpected Gemini probe: ${JSON.stringify(probe)}`);\n  return { name: probe.name };\n}\n\nregisterSiteAuthCommands({\n  site: 'gemini',\n  domain: 'gemini.google.com',\n  loginUrl: 'https://accounts.google.com/ServiceLogin?continue=https%3A%2F%2Fgemini.google.com%2F',\n  columns: ['name'],\n  quickCheck: hasGoogleSessionCookie,\n  verify: verifyGeminiIdentity,\n  poll: async (page) => {\n    if (!await hasGoogleSessionCookie(page)) {\n      throw new AuthRequiredError('gemini.google.com', 'Waiting for Google session cookies');\n    }\n    return verifyGeminiIdentity(page);\n  },\n});","sourceCodeStart":12,"sourceCodeEnd":48,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/gemini/auth.js#L12-L48","documentation":"An AuthRequiredError rethrowing the in-page probe's detail when the Google Account link's aria-label can't be parsed. The probe looks for `a[aria-label^=\"Google Account:\"]` and extracts the account name with a regex; if the label exists but doesn't match the expected pattern, it reports kind:'auth' with an 'unparseable' detail, signaling the session state is unverified.","triggerScenarios":"Inside verifyGeminiIdentity: the probe result has kind==='auth' — an account aria-label was found but `Google Account: <name>...` regex match failed, e.g. `Gemini aria-label unparseable: ...`.","commonSituations":"Google changed the aria-label format or locale (non-English label text); cookie present but page served a logged-out/interstitial state; partial login where account chip renders differently.","solutions":["Re-run `opencli gemini login` to establish a fully verified session","Confirm cookies via `opencli gemini whoami` / the site auth status command","Check the account label format in the automation browser and update the regex in clis/gemini/auth.js if Google changed it","Force the browser locale to English so the aria-label matches the expected prefix"],"exampleFix":"// before\nconst m = label.match(/^Google Account: (.+?)(?: \\(|$)/);\n// after\nconst m = label.match(/^Google Account:\\s*(.+?)(?: \\(|$)/); // tolerate spacing/format changes","handlingStrategy":"validation","validationCode":"const label = await getAccountAriaLabel();\nif (!/^Google Account: .+/.test(label)) {\n  await relogin(); // label format unexpected — refresh session\n}","typeGuard":"function isParsedAccount(probe) { return probe?.ok === true && typeof probe.name === 'string' && probe.name.length > 0; }","tryCatchPattern":"try {\n  const identity = await getGeminiIdentity();\n} catch (e) {\n  if (e.name === 'AuthRequiredError' && /unparseable/.test(e.message)) {\n    await geminiLogin(); // re-establish a verifiable session\n  } else throw e;\n}","preventionTips":["Keep the browser locale English so aria-labels match the expected format","Re-login when the account chip renders unexpectedly","Update the aria-label regex when Google changes label formatting","Verify identity via whoami before running ask commands"],"tags":["auth","gemini","parsing"],"backgroundTag":"auth-session-required","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}