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

  1. Run `opencli notebooklm open <notebook>` to navigate the adapter to a notebook before source-get.
  2. Run `opencli notebooklm current` to check which notebook (if any) the session has open.
  3. 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

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


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