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-get throws this EmptyResultError when a notebook is open, sources were listed, but findNotebooklmSourceRow could not match the --source argument (stringified from kwargs.source) against any row's title or id. It means the query resolved to zero rows.

Source

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

        },
    ],
    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 source-list` and copy the exact title/id of the target source.
  2. Correct the --source value (exact title or id as listed) and retry.
  3. If the source was deleted or renamed, re-add it or update the reference.

Example fix

// before
opencli notebooklm source-get --source "my report.pdf"
// after
opencli notebooklm source-list            # shows: "My Report (Final).pdf"
opencli notebooklm source-get --source "My Report (Final).pdf"
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(`No source matching "${wanted}"; run source-list for exact titles/ids`);

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-get', ['--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-get <notebook> --source "name"` where no listed source's title or id matches the query string (typo, stale title, partial match not supported, or passing a URL/filename instead of the listed title).

Common situations: Typo or different casing than the source title in NotebookLM; referencing a source that was deleted or renamed; quoting the local file path instead of the source title shown in the notebook; passing a source id from an old listing after the notebook changed.

Related errors


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