jackwener/OpenCLI · error · EmptyResultError
No NotebookLM notebook is open in the adapter session. Run `
Error message
No NotebookLM notebook is open in the adapter session. Run `opencli notebooklm open <notebook>` first.
What it means
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.
Source
Thrown at clis/notebooklm/source-get.js:27
description: 'Get one source from the currently opened NotebookLM notebook by id or title',
domain: NOTEBOOKLM_DOMAIN,
strategy: Strategy.COOKIE,
browser: true,
navigateBefore: false,
args: [
{
name: 'source',
positional: true,
required: true,
help: 'Source id or title from the current notebook',
},
],
columns: ['title', 'id', 'type', 'size', 'created_at', 'updated_at', 'url', 'source'],
func: async (page, kwargs) => {
await requireNotebooklmSession(page);
const state = await getNotebooklmPageState(page);
if (state.kind !== 'notebook') {
throw new EmptyResultError('opencli notebooklm source-get', 'No NotebookLM notebook is open in the adapter session. Run `opencli notebooklm open <notebook>` first.');
}
const rpcRows = await listNotebooklmSourcesViaRpc(page).catch(() => []);
const rows = rpcRows.length > 0 ? rpcRows : await listNotebooklmSourcesFromPage(page);
if (rows.length === 0) {
throw new EmptyResultError('opencli notebooklm source-get', 'No NotebookLM sources were found on the current page.');
}
const query = typeof kwargs.source === 'string' ? kwargs.source : String(kwargs.source ?? '');
const matched = findNotebooklmSourceRow(rows, query);
if (matched)
return [matched];
throw new EmptyResultError('opencli notebooklm source-get', `Source "${query}" was not found in the current notebook.`);
},
});
View on GitHub (pinned to 49907e53dc)
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.
Example fix
// before opencli notebooklm source-get --source "my-pdf" // after opencli notebooklm open "Research Notebook" opencli notebooklm source-get --source "my-pdf"
Defensive patterns
Strategy: validation
Validate before calling
const current = await exec('opencli notebooklm current --json');
if (!current?.id) { await exec('opencli notebooklm open "My Notebook"'); }
// only then run source-get Type guard
function isNotebookOpen(state) {
return state?.kind === 'notebook' && typeof state?.notebookId === 'string' && state.notebookId.length > 0;
} Try / catch
try {
await run('opencli notebooklm source-get', ['--source', name]);
} catch (err) {
if (/No NotebookLM notebook is open/.test(err.message)) {
await run('opencli notebooklm open', [notebook]);
return run('opencli notebooklm source-get', ['--source', name]);
}
throw err;
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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>.
Related errors
- No NotebookLM notebook is open in the adapter session. Run `
- No NotebookLM notebook is open in the adapter session. Run `
- No NotebookLM notebook is open in the adapter session. Run `
- --file path does not exist: ${filePath}
- --file path is not a regular file: ${filePath}
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/3ace7be85234328a.
Report an issue: GitHub.