{"record":{"id":"432c5d2aa69bb122","repo":"jackwener/OpenCLI","slug":"opencli-notebooklm-current","errorCode":null,"errorMessage":"opencli notebooklm current","messagePattern":"opencli notebooklm current","errorType":"exception","errorClass":"EmptyResultError","httpStatus":null,"severity":"error","filePath":"clis/notebooklm/current.js","lineNumber":20,"sourceCode":"import { EmptyResultError } from '@jackwener/opencli/errors';\nimport { NOTEBOOKLM_DOMAIN, NOTEBOOKLM_SITE } from './shared.js';\nimport { getNotebooklmPageState, readCurrentNotebooklm, requireNotebooklmSession } from './utils.js';\ncli({\n    site: NOTEBOOKLM_SITE,\n    name: 'current',\n    access: 'read',\n    description: 'Show metadata for the currently opened NotebookLM notebook tab',\n    domain: NOTEBOOKLM_DOMAIN,\n    strategy: Strategy.COOKIE,\n    browser: true,\n    navigateBefore: false,\n    args: [],\n    columns: ['id', 'title', 'url', 'source'],\n    func: async (page) => {\n        await requireNotebooklmSession(page);\n        const state = await getNotebooklmPageState(page);\n        if (state.kind !== 'notebook') {\n            throw new EmptyResultError('opencli notebooklm current', 'No NotebookLM notebook is open in the adapter session. Run `opencli notebooklm open <notebook>` first.');\n        }\n        const current = await readCurrentNotebooklm(page);\n        if (!current) {\n            throw new EmptyResultError('opencli notebooklm current', 'NotebookLM notebook metadata was not found on the current page.');\n        }\n        return [current];\n    },\n});\n","sourceCodeStart":2,"sourceCodeEnd":29,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/notebooklm/current.js#L2-L29","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","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."],"exampleFix":"// before\nopencli notebooklm current\n// after\nopencli notebooklm open \"My Research Notebook\"\nopencli notebooklm current","handlingStrategy":"validation","validationCode":"const state = await getNotebooklmPageState(page);\nif (state.kind !== 'notebook') {\n  await runCli(['notebooklm', 'open', notebookId]);\n}","typeGuard":"const isNotebookOpen = (state) => state?.kind === 'notebook';","tryCatchPattern":"try {\n  const rows = await runCli(['notebooklm', 'current']);\n} catch (e) {\n  if (String(e.message).includes('No NotebookLM notebook is open')) {\n    await runCli(['notebooklm', 'open', notebookId]);\n    return await runCli(['notebooklm', 'current']);\n  }\n  throw e;\n}","preventionTips":["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."],"tags":["notebooklm","empty-result","session-state","cli"],"backgroundTag":"notebook-not-open-in-session","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}