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-list throws this EmptyResultError when the session page is not a notebook page (state.kind !== 'notebook'), checked right after requireNotebooklmSession. Listing sources is meaningless outside a notebook, so the command aborts with an actionable hint.

Source

Thrown at clis/notebooklm/source-list.js:20

import { EmptyResultError } from '@jackwener/opencli/errors';
import { NOTEBOOKLM_DOMAIN, NOTEBOOKLM_SITE } from './shared.js';
import { getNotebooklmPageState, listNotebooklmSourcesFromPage, listNotebooklmSourcesViaRpc, requireNotebooklmSession, } from './utils.js';
cli({
    site: NOTEBOOKLM_SITE,
    name: 'source-list',
    access: 'read',
    description: 'List sources for the currently opened NotebookLM notebook',
    domain: NOTEBOOKLM_DOMAIN,
    strategy: Strategy.COOKIE,
    browser: true,
    navigateBefore: false,
    args: [],
    columns: ['title', 'id', 'type', 'size', 'created_at', 'updated_at', 'url', 'source'],
    func: async (page) => {
        await requireNotebooklmSession(page);
        const state = await getNotebooklmPageState(page);
        if (state.kind !== 'notebook') {
            throw new EmptyResultError('opencli notebooklm source-list', 'No NotebookLM notebook is open in the adapter session. Run `opencli notebooklm open <notebook>` first.');
        }
        const rpcRows = await listNotebooklmSourcesViaRpc(page).catch(() => []);
        if (rpcRows.length > 0)
            return rpcRows;
        const domRows = await listNotebooklmSourcesFromPage(page);
        if (domRows.length > 0)
            return domRows;
        throw new EmptyResultError('opencli notebooklm source-list', 'No NotebookLM sources were found on the current page.');
    },
});

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Run `opencli notebooklm open <notebook>` then `opencli notebooklm source-list`.
  2. Check `opencli notebooklm current` to confirm which notebook is active.
  3. Re-authenticate and reopen the notebook if the session was redirected to home.

Example fix

// before
opencli notebooklm source-list   # session on NotebookLM home
// after
opencli notebooklm open "Research Notebook"
opencli notebooklm source-list
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"');
// now source-list is safe

Type guard

function isNotebookOpen(state) {
  return state?.kind === 'notebook' && typeof state?.notebookId === 'string' && state.notebookId.length > 0;
}

Try / catch

try {
  return await run('opencli notebooklm source-list');
} catch (err) {
  if (/No NotebookLM notebook is open/.test(err.message)) {
    await run('opencli notebooklm open', [notebook]);
    return run('opencli notebooklm source-list');
  }
  throw err;
}

Prevention

When it happens

Trigger: `opencli notebooklm source-list` executed while the adapter sits on the NotebookLM home/dashboard or a non-NotebookLM/unknown page (no /notebook/<id> in the URL), typically because no notebook was ever opened in this session.

Common situations: Starting a fresh session and running source-list before open; the notebook tab was closed or redirected to home after auth expiry; passing a home-page URL instead of a notebook URL.

Related errors


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