{"record":{"id":"6c1a9e7988e007d5","repo":"jackwener/OpenCLI","slug":"notebooklm-requires-a-logged-in-google-session","errorCode":null,"errorMessage":"NotebookLM requires a logged-in Google session","messagePattern":"NotebookLM requires a logged-in Google session","errorType":"exception","errorClass":"AuthRequiredError","httpStatus":null,"severity":"error","filePath":"clis/notebooklm/utils.js","lineNumber":875,"sourceCode":"        notebook_id: notebookId,\n        title: text,\n        url: window.location.href,\n        source: 'current-page',\n      });\n    }\n    return rows;\n  })()`));\n    if (!Array.isArray(raw))\n        return [];\n    return raw.filter((row) => row.id && row.title);\n}\nexport async function requireNotebooklmSession(page) {\n    const state = await getNotebooklmPageState(page);\n    if (!parseTrustedNotebooklmUrl(state.url)) {\n        throw new CliError('NOTEBOOKLM_UNAVAILABLE', 'NotebookLM page is not available in the current browser session', `Open Chrome and navigate to ${NOTEBOOKLM_HOME_URL}`);\n    }\n    if (state.loginRequired) {\n        throw new AuthRequiredError(NOTEBOOKLM_DOMAIN, 'NotebookLM requires a logged-in Google session');\n    }\n    return state;\n}\n","sourceCodeStart":857,"sourceCodeEnd":879,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/notebooklm/utils.js#L857-L879","documentation":"After confirming a trusted NotebookLM URL, requireNotebooklmSession checks state.loginRequired. When the page indicates Google is not signed in, it throws AuthRequiredError for the NotebookLM domain so callers can trigger their authentication flow instead of scraping a logged-out page.","triggerScenarios":"The NotebookLM page loaded while the browser has no authenticated Google session — session cookie expired, incognito profile without login, Google signed the user out, or the page redirected to a sign-in screen detected as loginRequired.","commonSituations":"Cookie expiry after weeks of use, clearing browser data, switching Chrome profiles, Google forcing re-auth after a security event, or running against a fresh automation profile that never logged in.","solutions":["Sign in to Google in the attached Chrome session and reload the NotebookLM page.","Retry after completing any Google re-auth/2FA prompt shown in the browser.","Use a Chrome profile that persists cookies rather than incognito or a wiped automation profile.","Handle AuthRequiredError in your tooling by pausing and prompting the user to log in interactively."],"exampleFix":"// before: generic handling loses the auth signal\ncatch (e) { console.error(e.message); }\n\n// after: route auth errors to a login flow\ncatch (e) {\n  if (e instanceof AuthRequiredError) {\n    console.error(`Please sign in to ${e.domain} in Chrome, then retry.`);\n    return;\n  }\n  throw e;\n}","handlingStrategy":"try-catch","validationCode":"const state = await getNotebooklmPageState(page);\nif (state.loginRequired) {\n  console.error('Sign in to Google in Chrome, then retry.');\n  return;\n}","typeGuard":"const isAuthRequired = (e) => e instanceof AuthRequiredError || (e && e.name === 'AuthRequiredError');","tryCatchPattern":"try {\n  const state = await requireNotebooklmSession(page);\n} catch (e) {\n  if (e instanceof AuthRequiredError) {\n    console.error(`Please sign in to ${e.domain} in the attached Chrome session and retry.`);\n    return;\n  }\n  throw e;\n}","preventionTips":["Use a persistent Chrome profile (not incognito) with an active Google session.","Re-check login state after long idle periods; Google sessions expire.","Avoid wiping browser data on profiles used for automation.","Route AuthRequiredError to an interactive login prompt in tooling."],"tags":["authentication","google-session","notebooklm","auth-required"],"backgroundTag":"auth-required","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}