jackwener/OpenCLI · error · EmptyResultError

Source "${query}" was not found in the current notebook.

Error message

Source "${query}" was not found in the current notebook.

What it means

opencli notebooklm source-guide throws this EmptyResultError when the notebook and sources are fine, but findNotebooklmSourceRow found no row matching the --source argument. The query stringified from kwargs.source matched zero listed sources.

Source

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

            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 source-list` to get exact source titles/ids.
  2. Retry with the exact title or id from the listing.
  3. Re-add the source if it was deleted; update scripts to reference the current title.

Example fix

// before
opencli notebooklm source-guide --source "report"
// after
opencli notebooklm source-list              # exact title: "Q3 Report"
opencli notebooklm source-guide --source "Q3 Report"
Defensive patterns

Strategy: validation

Validate before calling

const sources = await exec('opencli notebooklm source-list --json');
const hit = sources.find(s => s.title === wanted || s.id === wanted);
if (!hit) throw new Error(`Source "${wanted}" not found; check source-list`);

Type guard

function findSourceRow(rows, query) {
  if (!Array.isArray(rows) || typeof query !== 'string') return null;
  const q = query.trim().toLowerCase();
  return rows.find(r => r?.title?.toLowerCase() === q || r?.id === query) ?? null;
}

Try / catch

try {
  return await run('opencli notebooklm source-guide', ['--source', name]);
} catch (err) {
  if (/was not found in the current notebook/.test(err.message)) {
    const rows = await run('opencli notebooklm source-list');
    throw new Error(`"${name}" not found. Available: ${rows.map(r => r.title).join(', ')}`);
  }
  throw err;
}

Prevention

When it happens

Trigger: `opencli notebooklm source-guide --source "title"` where no source title or id matches the provided string: typo, renamed/deleted source, or passing a file path/URL instead of the listed title.

Common situations: Casing or wording differs from the NotebookLM source title; source removed since the last listing; using an id from a different notebook; quotes/spaces mismatch.

Related errors


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