jackwener/OpenCLI · error · EmptyResultError

No NotebookLM sources were found on the current page.

Error message

No NotebookLM sources were found on the current page.

What it means

opencli notebooklm source-get throws this EmptyResultError when a valid notebook page is open but neither the internal RPC listing nor DOM scraping found any source rows. It guards against proceeding with an empty source list that could never match the user's query.

Source

Thrown at clis/notebooklm/source-get.js:32

    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. Add at least one source to the notebook (via `opencli notebooklm add-source` or the NotebookLM web UI).
  2. Reload the notebook (`opencli notebooklm open <notebook>` again) and retry so the source list finishes loading.
  3. Retry after a short delay if the page was still rendering; if it persists, the adapter may need updating for a NotebookLM UI change.

Example fix

// before
opencli notebooklm source-get --source "notes"   # empty notebook
// after
opencli notebooklm add-source "notes.md"
opencli notebooklm source-get --source "notes"
Defensive patterns

Strategy: validation

Validate before calling

const sources = await exec('opencli notebooklm source-list --json');
if (!Array.isArray(sources) || sources.length === 0) throw new Error('Notebook has no sources; add one before source-get');

Type guard

function hasSources(rows) {
  return Array.isArray(rows) && rows.length > 0 && typeof rows[0]?.id === 'string';
}

Try / catch

try {
  return await run('opencli notebooklm source-get', ['--source', name]);
} catch (err) {
  if (/No NotebookLM sources were found/.test(err.message)) {
    await run('opencli notebooklm add-source', [file]);
    return run('opencli notebooklm source-get', ['--source', name]);
  }
  throw err;
}

Prevention

When it happens

Trigger: Calling source-get on a newly created notebook with zero sources, on a notebook whose source list failed to load (slow network, UI still rendering), or when both listNotebooklmSourcesViaRpc and listNotebooklmSourcesFromPage return empty arrays.

Common situations: Brand-new notebook with no uploads yet; NotebookLM UI changed so DOM selectors and RPC parsing both fail; page was captured mid-load before sources rendered; sync issues between Google services.

Related errors


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