{"record":{"id":"3ace7be85234328a","repo":"jackwener/OpenCLI","slug":"no-notebooklm-notebook-is-open-in-the-adapter-sess-3ace7b","errorCode":null,"errorMessage":"No NotebookLM notebook is open in the adapter session. Run `opencli notebooklm open <notebook>` first.","messagePattern":"No NotebookLM notebook is open in the adapter session\\. Run `opencli notebooklm open <notebook>` first\\.","errorType":"exception","errorClass":"EmptyResultError","httpStatus":null,"severity":"error","filePath":"clis/notebooklm/source-get.js","lineNumber":27,"sourceCode":"    description: 'Get one source from the currently opened NotebookLM notebook by id or title',\n    domain: NOTEBOOKLM_DOMAIN,\n    strategy: Strategy.COOKIE,\n    browser: true,\n    navigateBefore: false,\n    args: [\n        {\n            name: 'source',\n            positional: true,\n            required: true,\n            help: 'Source id or title from the current notebook',\n        },\n    ],\n    columns: ['title', 'id', 'type', 'size', 'created_at', 'updated_at', 'url', 'source'],\n    func: async (page, kwargs) => {\n        await requireNotebooklmSession(page);\n        const state = await getNotebooklmPageState(page);\n        if (state.kind !== 'notebook') {\n            throw new EmptyResultError('opencli notebooklm source-get', 'No NotebookLM notebook is open in the adapter session. Run `opencli notebooklm open <notebook>` first.');\n        }\n        const rpcRows = await listNotebooklmSourcesViaRpc(page).catch(() => []);\n        const rows = rpcRows.length > 0 ? rpcRows : await listNotebooklmSourcesFromPage(page);\n        if (rows.length === 0) {\n            throw new EmptyResultError('opencli notebooklm source-get', 'No NotebookLM sources were found on the current page.');\n        }\n        const query = typeof kwargs.source === 'string' ? kwargs.source : String(kwargs.source ?? '');\n        const matched = findNotebooklmSourceRow(rows, query);\n        if (matched)\n            return [matched];\n        throw new EmptyResultError('opencli notebooklm source-get', `Source \"${query}\" was not found in the current notebook.`);\n    },\n});\n","sourceCodeStart":9,"sourceCodeEnd":41,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/notebooklm/source-get.js#L9-L41","documentation":"opencli notebooklm source-get throws this EmptyResultError when the browser adapter session is authenticated but the active page is not a specific notebook (state.kind !== 'notebook'). Source lookups require a notebook context because sources only exist inside a notebook page. The library throws it early, before attempting RPC or DOM scraping, to fail with a clear actionable message.","triggerScenarios":"Running `opencli notebooklm source-get --source <query>` while the adapter page sits on the NotebookLM home/dashboard (URL lacks /notebook/<id>), on another host, or on an unrecognized page classified as 'unknown' by getNotebooklmPageState.","commonSituations":"Forgot to run `opencli notebooklm open <notebook>` first; the previously opened notebook tab was closed, navigated away, or the session was restarted; NotebookLM redirected to home after an auth hiccup so the URL no longer contains /notebook/<id>.","solutions":["Run `opencli notebooklm open <notebook>` to navigate the adapter to a notebook before source-get.","Run `opencli notebooklm current` to check which notebook (if any) the session has open.","Re-authenticate if NotebookLM bounced you to the home/login page, then reopen the notebook."],"exampleFix":"// before\nopencli notebooklm source-get --source \"my-pdf\"\n// after\nopencli notebooklm open \"Research Notebook\"\nopencli notebooklm source-get --source \"my-pdf\"","handlingStrategy":"validation","validationCode":"const current = await exec('opencli notebooklm current --json');\nif (!current?.id) { await exec('opencli notebooklm open \"My Notebook\"'); }\n// only then run source-get","typeGuard":"function isNotebookOpen(state) {\n  return state?.kind === 'notebook' && typeof state?.notebookId === 'string' && state.notebookId.length > 0;\n}","tryCatchPattern":"try {\n  await run('opencli notebooklm source-get', ['--source', name]);\n} catch (err) {\n  if (/No NotebookLM notebook is open/.test(err.message)) {\n    await run('opencli notebooklm open', [notebook]);\n    return run('opencli notebooklm source-get', ['--source', name]);\n  }\n  throw err;\n}","preventionTips":["Always pair source commands with a preceding `opencli notebooklm open <notebook>` in scripts.","Check `opencli notebooklm current` before batch source operations.","Keep the adapter tab on the notebook page; avoid navigating it during automation.","Handle auth-expiry redirects by re-running open after re-login."],"tags":["notebooklm","prerequisite-not-met","browser-adapter"],"backgroundTag":"notebooklm-no-notebook-open","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}