jackwener/OpenCLI · error · EmptyResultError

opencli notebooklm notes-get

Error message

opencli notebooklm notes-get

What it means

`opencli notebooklm notes-get <note>` throws this EmptyResultError when the session is not on a notebook page. Like note-list, reading note content requires an open notebook context; the guard on getNotebooklmPageState fires before any note lookup.

Source

Thrown at clis/notebooklm/notes-get.js:34

    description: 'Get one note from the current NotebookLM notebook by title from the visible note editor',
    domain: NOTEBOOKLM_DOMAIN,
    strategy: Strategy.COOKIE,
    browser: true,
    navigateBefore: false,
    args: [
        {
            name: 'note',
            positional: true,
            required: true,
            help: 'Note title or id from the current notebook',
        },
    ],
    columns: ['title', 'content', 'source', 'url'],
    func: async (page, kwargs) => {
        await requireNotebooklmSession(page);
        const state = await getNotebooklmPageState(page);
        if (state.kind !== 'notebook') {
            throw new EmptyResultError('opencli notebooklm notes-get', 'No NotebookLM notebook is open in the adapter session. Run `opencli notebooklm open <notebook>` first.');
        }
        const query = typeof kwargs.note === 'string' ? kwargs.note : String(kwargs.note ?? '');
        const visible = await readNotebooklmVisibleNoteFromPage(page);
        if (visible && matchesNoteTitle(visible.title, query))
            return [visible];
        const rows = await listNotebooklmNotesFromPage(page);
        const listed = findNotebooklmNoteRow(rows, query);
        if (listed) {
            throw new EmptyResultError('opencli notebooklm notes-get', `Note "${query}" is listed in Studio, but opencli currently reads note content only from the visible note editor. Open that note in NotebookLM, then retry.`);
        }
        throw new EmptyResultError('opencli notebooklm notes-get', `Note "${query}" was not found in the current notebook.`);
    },
});

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Run `opencli notebooklm open <notebook-id-or-url>` first, then `opencli notebooklm notes-get <note-title>`.
  2. Confirm the id with `opencli notebooklm list -f json` if `open` keeps failing.
  3. Re-authenticate the browser session if redirects persist.
  4. Avoid navigating the shared page between `open` and `notes-get`.

Example fix

// before
opencli notebooklm notes-get "Summary"
// after
opencli notebooklm open <notebook-id>
opencli notebooklm notes-get "Summary"
Defensive patterns

Strategy: validation

Validate before calling

const opened = await run('opencli notebooklm get -f json').catch(() => null);
if (!opened) throw new Error('Open a notebook before notes-get');

Type guard

function canQueryNotes(state) {
  return !!state && Array.isArray(state) && state.length > 0 && !!state[0].id;
}

Try / catch

try {
  note = await run(`opencli notebooklm notes-get "${title}" -f json`);
} catch (e) {
  if (String(e.message).includes('No NotebookLM notebook is open')) {
    await run('opencli notebooklm open <notebook-id>');
    note = await run(`opencli notebooklm notes-get "${title}" -f json`);
  } else throw e;
}

Prevention

When it happens

Trigger: Calling `notes-get` with a note title when getNotebooklmPageState(page).kind !== 'notebook' — no prior `open`, or the page navigated/redirected away from the notebook.

Common situations: Forgetting to run `open` in a fresh session; a failed or wrong-id `open` leaving the page on the home surface; cookie expiry redirect; running notes-get against a notebook URL that was never opened in this adapter session.

Related errors


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