jackwener/OpenCLI · error · EmptyResultError
opencli notebooklm current
Error message
opencli notebooklm current
What it means
This EmptyResultError is thrown by the `opencli notebooklm current` command when the adapter's browser page is not showing a NotebookLM notebook (state.kind !== 'notebook'). The command requires an open notebook to report its metadata, so without one it has no rows to return and raises this error instead.
Source
Thrown at clis/notebooklm/current.js:20
import { EmptyResultError } from '@jackwener/opencli/errors';
import { NOTEBOOKLM_DOMAIN, NOTEBOOKLM_SITE } from './shared.js';
import { getNotebooklmPageState, readCurrentNotebooklm, requireNotebooklmSession } from './utils.js';
cli({
site: NOTEBOOKLM_SITE,
name: 'current',
access: 'read',
description: 'Show metadata for the currently opened NotebookLM notebook tab',
domain: NOTEBOOKLM_DOMAIN,
strategy: Strategy.COOKIE,
browser: true,
navigateBefore: false,
args: [],
columns: ['id', 'title', 'url', 'source'],
func: async (page) => {
await requireNotebooklmSession(page);
const state = await getNotebooklmPageState(page);
if (state.kind !== 'notebook') {
throw new EmptyResultError('opencli notebooklm current', 'No NotebookLM notebook is open in the adapter session. Run `opencli notebooklm open <notebook>` first.');
}
const current = await readCurrentNotebooklm(page);
if (!current) {
throw new EmptyResultError('opencli notebooklm current', 'NotebookLM notebook metadata was not found on the current page.');
}
return [current];
},
});
View on GitHub (pinned to 49907e53dc)
Solutions
- Run `opencli notebooklm open <notebook-id-or-title>` first, then re-run `opencli notebooklm current`.
- Verify the session page actually shows the notebook (not the NotebookLM home list) before calling current.
- Re-open the adapter session if the page state is stale.
Example fix
// before opencli notebooklm current // after opencli notebooklm open "My Research Notebook" opencli notebooklm current
Defensive patterns
Strategy: validation
Validate before calling
const state = await getNotebooklmPageState(page);
if (state.kind !== 'notebook') {
await runCli(['notebooklm', 'open', notebookId]);
} Type guard
const isNotebookOpen = (state) => state?.kind === 'notebook';
Try / catch
try {
const rows = await runCli(['notebooklm', 'current']);
} catch (e) {
if (String(e.message).includes('No NotebookLM notebook is open')) {
await runCli(['notebooklm', 'open', notebookId]);
return await runCli(['notebooklm', 'current']);
}
throw e;
} Prevention
- Always call `notebooklm open` before `notebooklm current` in scripts.
- Do not navigate the shared session page between open and current.
- Check page state (kind === 'notebook') before invoking the command.
When it happens
Trigger: Running `opencli notebooklm current` when no notebook was ever opened, after the session navigated away from the notebook page, or when the page state classifier identifies the current page as a different kind (e.g. home/list view).
Common situations: Fresh adapter session where `notebooklm open <notebook>` was never run; user navigated to the NotebookLM home screen mid-session; session restarted and page state was lost.
Related errors
- opencli notebooklm get
- opencli notebooklm history
- 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/432c5d2aa69bb122.
Report an issue: GitHub.