jackwener/OpenCLI · error · AuthRequiredError
NotebookLM redirected to Google sign-in
Error message
NotebookLM redirected to Google sign-in
What it means
After SSO cookies are present, verifyNotebookLmIdentity navigates to NotebookLM and probes the page. If the in-page probe detects a redirect to Google sign-in (or the account chip reports an auth problem), it throws AuthRequiredError with the probe's detail as the message. This means cookies exist but the session is not actually valid for NotebookLM.
Source
Thrown at clis/notebooklm/auth.js:39
return { kind: 'auth', detail: 'NotebookLM redirected to Google sign-in' };
}
const acctEl = document.querySelector('a[aria-label^="Google Account:"], a[aria-label*="Google 账号:"]');
if (!acctEl) {
return { kind: 'auth', detail: 'NotebookLM missing Google Account button' };
}
const label = acctEl.getAttribute('aria-label') || '';
const nameMatch = label.match(/Google Account:\\s*([^\\n\\(]+?)(?:\\s*\\n|\\s*\\()/i) ||
label.match(/Google 账号:\\s*([^\\n\\(]+?)(?:\\s*\\n|\\s*\\()/i);
const name = nameMatch ? nameMatch[1].trim() : '';
const authuserMatch = location.href.match(/[?&]authuser=(\\d+)/);
const authuser = authuserMatch ? Number(authuserMatch[1]) : 0;
if (!name) {
return { kind: 'auth', detail: 'NotebookLM Google Account aria-label found but name unparseable' };
}
return { ok: true, name, authuser };
})()
`));
if (probe?.kind === 'auth') throw new AuthRequiredError(NOTEBOOKLM_DOMAIN, probe.detail);
if (!probe?.ok) throw new CommandExecutionError(`Unexpected NotebookLM probe: ${JSON.stringify(probe)}`);
return { name: probe.name, authuser: probe.authuser };
}
registerSiteAuthCommands({
site: 'notebooklm',
domain: 'google.com',
loginUrl: `https://accounts.google.com/ServiceLogin?service=lso&continue=${encodeURIComponent(NOTEBOOKLM_HOME_URL)}`,
columns: ['name', 'authuser'],
quickCheck: hasNotebookLmSsoCookies,
verify: verifyNotebookLmIdentity,
poll: async (page) => {
if (!await hasNotebookLmSsoCookies(page)) {
throw new AuthRequiredError(NOTEBOOKLM_DOMAIN, 'Waiting for Google SSO cookies (SID + SAPISID)');
}
return verifyNotebookLmIdentity(page);
},
});View on GitHub (pinned to 49907e53dc)
Solutions
- Re-run the login flow to establish a fresh, valid Google session.
- Clear stale Google cookies and log in again.
- Confirm you can open notebooklm.google.com in the same browser profile and see your notebooks.
- If the account chip exists but the name is unparseable, check for NotebookLM UI changes affecting the probe selector.
Defensive patterns
Strategy: try-catch
Try / catch
try {
await cmd();
} catch (e) {
if (String(e.message).includes('redirected to Google sign-in') || e.name === 'AuthRequiredError') {
await login('notebooklm');
return cmd();
}
throw e;
} Prevention
- Re-login when cookies age out; presence of SID/SAPISID doesn't guarantee validity.
- Confirm notebooklm.google.com loads correctly in the profile before automating.
- Handle AuthRequiredError as a recoverable condition by triggering the login flow.
When it happens
Trigger: Cookies SID/SAPISID exist but page.goto(NOTEBOOKLM_HOME_URL) redirects to accounts.google.com sign-in, or the probe script returns { kind: 'auth', detail: ... } (e.g. aria-label found but name unparseable).
Common situations: Expired SAPISID authorization while SID lingers; logged-out of the specific Google account; Google forcing re-verification; wrong authuser slot selected.
Related errors
- Google SSO cookies (SID + SAPISID) missing
- Waiting for Google SSO cookies (SID + SAPISID)
- opencli notebooklm list
- NOTEBOOKLM_TOKENS
- NotebookLM page auth probe is not on a trusted HTTPS Noteboo
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/56bd87ab1153d87c.
Report an issue: GitHub.