jackwener/OpenCLI · error · CliError

NOTEBOOKLM_UNAVAILABLE

NOTEBOOKLM_UNAVAILABLE

Error message

NotebookLM page is not available in the current browser session

What it means

requireNotebooklmSession inspects the current page state and verifies its URL parses as a trusted NotebookLM URL. If not, it concludes no usable NotebookLM page exists in the browser session and throws a CliError with code NOTEBOOKLM_UNAVAILABLE, including a remediation hint to open Chrome at the NotebookLM home URL.

Source

Thrown at clis/notebooklm/utils.js:872

      seen.add(text);
      rows.push({
        id: text,
        notebook_id: notebookId,
        title: text,
        url: window.location.href,
        source: 'current-page',
      });
    }
    return rows;
  })()`));
    if (!Array.isArray(raw))
        return [];
    return raw.filter((row) => row.id && row.title);
}
export async function requireNotebooklmSession(page) {
    const state = await getNotebooklmPageState(page);
    if (!parseTrustedNotebooklmUrl(state.url)) {
        throw new CliError('NOTEBOOKLM_UNAVAILABLE', 'NotebookLM page is not available in the current browser session', `Open Chrome and navigate to ${NOTEBOOKLM_HOME_URL}`);
    }
    if (state.loginRequired) {
        throw new AuthRequiredError(NOTEBOOKLM_DOMAIN, 'NotebookLM requires a logged-in Google session');
    }
    return state;
}

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Open Chrome and navigate to the NotebookLM home URL shown in the error hint (NOTEBOOKLM_HOME_URL).
  2. Reconnect the Browser Bridge (restart the extension or relaunch Chrome with the expected debug/automation flags).
  3. Make sure a NotebookLM tab — not another site — is active before re-running the command.
  4. If automating headlessly, verify the browser session the CLI attaches to is still alive.

Example fix

// before: assuming a session exists
const state = await requireNotebooklmSession(page);

// after: check availability and guide the user
try {
  const state = await requireNotebooklmSession(page);
} catch (e) {
  if (e.code === 'NOTEBOOKLM_UNAVAILABLE') {
    console.error('Open Chrome at https://notebooklm.google.com/ and retry.');
    return;
  }
  throw e;
}
Defensive patterns

Strategy: try-catch

Validate before calling

const state = await getNotebooklmPageState(page).catch(() => null);
if (!state || !parseTrustedNotebooklmUrl(state.url)) {
  console.error(`Open Chrome and navigate to ${NOTEBOOKLM_HOME_URL} first.`);
  process.exit(1);
}

Type guard

const hasNotebooklmSession = (state) => state && typeof state.url === 'string' && parseTrustedNotebooklmUrl(state.url) !== null;

Try / catch

try {
  const state = await requireNotebooklmSession(page);
} catch (e) {
  if (e.code === 'NOTEBOOKLM_UNAVAILABLE') {
    console.error(e.hint ?? 'Open Chrome and navigate to the NotebookLM home URL.');
    return;
  }
  throw e;
}

Prevention

When it happens

Trigger: getNotebooklmPageState returns a state whose url is not a notebooklm.google.com URL — no browser attached, no NotebookLM tab open, the tab shows about:blank or another site, or the bridge connection dropped.

Common situations: Running the CLI before launching Chrome, Chrome closed between commands, focused tab is a different site, or the Browser Bridge debug target disappeared after a browser restart.

Related errors


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