jackwener/OpenCLI · error · EmptyResultError
opencli notebooklm history
Error message
opencli notebooklm history
What it means
`opencli notebooklm history` throws this EmptyResultError when no notebook is currently open in the adapter session. The command requires a notebook context to fetch its chat history via listNotebooklmHistoryViaRpc, and getNotebooklmPageState reports a page kind other than 'notebook' (e.g. the home page or another surface).
Source
Thrown at clis/notebooklm/history.js:20
import { EmptyResultError } from '@jackwener/opencli/errors';
import { NOTEBOOKLM_DOMAIN, NOTEBOOKLM_SITE } from './shared.js';
import { getNotebooklmPageState, listNotebooklmHistoryViaRpc, requireNotebooklmSession, } from './utils.js';
cli({
site: NOTEBOOKLM_SITE,
name: 'history',
access: 'read',
description: 'List NotebookLM conversation history threads in the current notebook',
domain: NOTEBOOKLM_DOMAIN,
strategy: Strategy.COOKIE,
browser: true,
navigateBefore: false,
args: [],
columns: ['thread_id', 'item_count', 'preview', 'source', 'notebook_id', 'url'],
func: async (page) => {
await requireNotebooklmSession(page);
const state = await getNotebooklmPageState(page);
if (state.kind !== 'notebook') {
throw new EmptyResultError('opencli notebooklm history', 'No NotebookLM notebook is open in the adapter session. Run `opencli notebooklm open <notebook>` first.');
}
const rows = await listNotebooklmHistoryViaRpc(page);
return rows;
},
});
View on GitHub (pinned to 49907e53dc)
Solutions
- Run `opencli notebooklm open <notebook-id-or-url>` first, then retry `opencli notebooklm history`.
- Verify with `opencli notebooklm list -f json` that the notebook id you pass to `open` is valid.
- Re-authenticate / refresh the browser session cookies if NotebookLM keeps redirecting to the home page.
- Keep the same page session alive between `open` and `history`; do not navigate the page in between.
Example fix
// before opencli notebooklm history // after opencli notebooklm open abc123-notebook opencli notebooklm history
Defensive patterns
Strategy: validation
Validate before calling
const state = await run('opencli notebooklm get -f json').catch(() => null);
if (!state) throw new Error('No notebook open: run `opencli notebooklm open <notebook>` before history'); Type guard
function isNotebookOpen(state) {
return !!state && state.kind === 'notebook' && typeof state.id === 'string';
} Try / catch
try {
history = await run('opencli notebooklm history -f json');
} catch (e) {
if (String(e.message).includes('notebooklm history')) {
await run('opencli notebooklm open <notebook-id>');
history = await run('opencli notebooklm history -f json');
} else throw e;
} Prevention
- Script an explicit `open` step before any notebook-scoped command.
- Do not navigate the shared page between `open` and `history`.
- Watch for auth redirects that silently move the page off the notebook.
- Keep the adapter session alive for the whole workflow.
When it happens
Trigger: Calling `opencli notebooklm history` (args: []) when getNotebooklmPageState(page).kind !== 'notebook' — typically because `opencli notebooklm open <notebook>` was never run in this session, or the browser navigated away.
Common situations: Fresh adapter session where only `list` was run; previous `open` failed silently; session cookies expired and NotebookLM redirected to the home page; script reuses a page that last visited the notebook list.
Related errors
- opencli notebooklm current
- opencli notebooklm get
- opencli notebooklm note-list
- opencli notebooklm notes-get
- No NotebookLM notebook is open in the adapter session. Run `
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/34ffa6ed672d57be.
Report an issue: GitHub.