{"record":{"id":"9a37d7d342794d3d","repo":"jackwener/OpenCLI","slug":"notebooklm-unavailable","errorCode":"NOTEBOOKLM_UNAVAILABLE","errorMessage":"NotebookLM page is not available in the current browser session","messagePattern":"NotebookLM page is not available in the current browser session","errorType":"error_code","errorClass":"CliError","httpStatus":null,"severity":"error","filePath":"clis/notebooklm/utils.js","lineNumber":872,"sourceCode":"      seen.add(text);\n      rows.push({\n        id: text,\n        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":854,"sourceCodeEnd":879,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/notebooklm/utils.js#L854-L879","documentation":"requireNotebooklmSession inspects the current page state and verifies its URL parses as a trusted NotebookLM URL. If not, it concludes no usable NotebookLM page exists in the browser session and throws a CliError with code NOTEBOOKLM_UNAVAILABLE, including a remediation hint to open Chrome at the NotebookLM home URL.","triggerScenarios":"getNotebooklmPageState returns a state whose url is not a notebooklm.google.com URL — no browser attached, no NotebookLM tab open, the tab shows about:blank or another site, or the bridge connection dropped.","commonSituations":"Running the CLI before launching Chrome, Chrome closed between commands, focused tab is a different site, or the Browser Bridge debug target disappeared after a browser restart.","solutions":["Open Chrome and navigate to the NotebookLM home URL shown in the error hint (NOTEBOOKLM_HOME_URL).","Reconnect the Browser Bridge (restart the extension or relaunch Chrome with the expected debug/automation flags).","Make sure a NotebookLM tab — not another site — is active before re-running the command.","If automating headlessly, verify the browser session the CLI attaches to is still alive."],"exampleFix":"// before: assuming a session exists\nconst state = await requireNotebooklmSession(page);\n\n// after: check availability and guide the user\ntry {\n  const state = await requireNotebooklmSession(page);\n} catch (e) {\n  if (e.code === 'NOTEBOOKLM_UNAVAILABLE') {\n    console.error('Open Chrome at https://notebooklm.google.com/ and retry.');\n    return;\n  }\n  throw e;\n}","handlingStrategy":"try-catch","validationCode":"const state = await getNotebooklmPageState(page).catch(() => null);\nif (!state || !parseTrustedNotebooklmUrl(state.url)) {\n  console.error(`Open Chrome and navigate to ${NOTEBOOKLM_HOME_URL} first.`);\n  process.exit(1);\n}","typeGuard":"const hasNotebooklmSession = (state) => state && typeof state.url === 'string' && parseTrustedNotebooklmUrl(state.url) !== null;","tryCatchPattern":"try {\n  const state = await requireNotebooklmSession(page);\n} catch (e) {\n  if (e.code === 'NOTEBOOKLM_UNAVAILABLE') {\n    console.error(e.hint ?? 'Open Chrome and navigate to the NotebookLM home URL.');\n    return;\n  }\n  throw e;\n}","preventionTips":["Launch Chrome and open the NotebookLM home page before running commands.","Check Browser Bridge connectivity after every browser restart.","Keep a dedicated Chrome profile with NotebookLM open for automation.","Probe page state early in scripts and fail fast with a clear user hint."],"tags":["notebooklm","browser-session","unavailable","browser-bridge"],"backgroundTag":"browser-session-unavailable","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}