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-guide throws this EmptyResultError when the adapter session page is not currently on a notebook (state.kind !== 'notebook'). Source guides (FAQ/summaries per source) require an open notebook context, so the command fails fast before any listing.

Source

Thrown at clis/notebooklm/source-guide.js:27

    description: 'Get the guide summary and keywords for one source in the currently opened NotebookLM notebook',
    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: ['source_id', 'notebook_id', 'title', 'type', 'summary', 'keywords', 'source'],
    func: async (page, kwargs) => {
        await requireNotebooklmSession(page);
        const state = await getNotebooklmPageState(page);
        if (state.kind !== 'notebook') {
            throw new EmptyResultError('opencli notebooklm source-guide', '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-guide', '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) {
            throw new EmptyResultError('opencli notebooklm source-guide', `Source "${query}" was not found in the current notebook.`);
        }
        const guide = await getNotebooklmSourceGuideViaRpc(page, matched).catch(() => null);
        if (guide)
            return [guide];
        throw new EmptyResultError('opencli notebooklm source-guide', `NotebookLM guide was not available for source "${matched.title}".`);
    },
});

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Run `opencli notebooklm open <notebook>` first, then retry source-guide.
  2. Verify with `opencli notebooklm current` that a notebook is active.
  3. Re-authenticate if the session bounced to home/login, then reopen the notebook.

Example fix

// before
opencli notebooklm source-guide --source "specs"
// after
opencli notebooklm open "Product Docs"
opencli notebooklm source-guide --source "specs"
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"'); }
// then run source-guide

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-guide', ['--source', name]);
} catch (err) {
  if (/No NotebookLM notebook is open/.test(err.message)) {
    await run('opencli notebooklm open', [notebook]);
    return run('opencli notebooklm source-guide', ['--source', name]);
  }
  throw err;
}

Prevention

When it happens

Trigger: Running `opencli notebooklm source-guide` while the browser page is on the NotebookLM home screen, a non-NotebookLM URL, or an unrecognized page, i.e. after forgetting `opencli notebooklm open <notebook>` or after the tab navigated away.

Common situations: Fresh adapter session with no notebook opened; previous notebook tab closed or redirected; NotebookLM forced a return to home due to auth expiry so the /notebook/<id> URL was lost.

Related errors


AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29). Data as JSON: /api/errors/5056241f0a7ce5bb. Report an issue: GitHub.