jackwener/OpenCLI · error · CommandExecutionError
NotebookLM ${label} failed: ${error?.message || error}
Error message
NotebookLM ${label} failed: ${error?.message || error} What it means
rethrowNotebooklmTransport is the catch-side wrapper for Browser Bridge operations (page auth probe, in-page fetch). If the caught error is already a CliError it is rethrown unchanged; otherwise the original error (possibly a browser automation failure, navigation error, or TypeError) is converted into a CommandExecutionError with the label and the original message appended. This normalizes non-library exceptions into the CLI's error hierarchy while preserving the cause.
Source
Thrown at clis/notebooklm/rpc.js:16
import { AuthRequiredError, CliError, CommandExecutionError } from '@jackwener/opencli/errors';
import { NOTEBOOKLM_DOMAIN, parseTrustedNotebooklmUrl } from './shared.js';
const NOTEBOOKLM_RPC_PATH = '/_/LabsTailwindUi/data/batchexecute';
function requireNotebooklmObject(value, label) {
if (!value || typeof value !== 'object' || Array.isArray(value)) {
throw new CommandExecutionError(`NotebookLM ${label} returned a malformed Browser Bridge payload`);
}
return value;
}
function rethrowNotebooklmTransport(error, label) {
if (error instanceof CliError)
throw error;
throw new CommandExecutionError(`NotebookLM ${label} failed: ${error?.message || error}`);
}
export function unwrapNotebooklmEvaluateResult(payload) {
if (payload && typeof payload === 'object' && !Array.isArray(payload) && 'session' in payload && 'data' in payload) {
return payload.data;
}
return payload;
}
export function extractNotebooklmPageAuthFromHtml(html, sourcePath = '/', preferredTokens) {
const csrfMatch = html.match(/"SNlM0e":"([^"]+)"/);
const sessionMatch = html.match(/"FdrFJe":"([^"]+)"/);
const csrfToken = preferredTokens?.csrfToken?.trim() || (csrfMatch ? csrfMatch[1] : '');
const sessionId = preferredTokens?.sessionId?.trim() || (sessionMatch ? sessionMatch[1] : '');
if (!csrfToken || !sessionId) {
throw new CliError('NOTEBOOKLM_TOKENS', 'NotebookLM page tokens were not found in the current page HTML', 'Open the NotebookLM notebook page in Chrome, wait for it to finish loading, then retry with --verbose if it still fails.');
}
return { csrfToken, sessionId, sourcePath: sourcePath || '/', authuser: preferredTokens?.authuser ?? '' };View on GitHub (pinned to 49907e53dc)
Solutions
- Read error?.message in the output — it carries the underlying cause; fix that cause
- Reopen the target NotebookLM tab and ensure the browser session stays alive during the command
- Retry the command; transient navigation/timing issues often resolve
- Run with --verbose for the full underlying stack and raw error
Defensive patterns
Strategy: try-catch
Validate before calling
if (!browser.isConnected() || (await browser.pages()).length === 0) {
throw new Error('No live Chrome tab available for Browser Bridge operations');
} Type guard
function isCliError(e) {
return e instanceof CliError;
} Try / catch
try {
await fetchNotebooklmInPage(page, url);
} catch (e) {
console.error(`NotebookLM ${label} failed — underlying cause: ${e?.message || e}. Ensure Chrome tab is open and the page is loaded.`);
} Prevention
- Keep the Chrome window open and the tab active during CLI operations
- Avoid navigating or closing the tab while a command runs
- Run with --verbose so the underlying transport error is visible
When it happens
Trigger: Any throw inside probeNotebooklmPageAuth or fetchNotebooklmInPage from page.evaluate/browser bridge machinery that is not already a CliError — e.g. browser tab closed, evaluate timed out, navigation interrupted, or a raw JS exception inside the injected script.
Common situations: Chrome was closed mid-operation by the user or by idle tab discard; slow network caused the evaluate to time out; a page reload/redirect happened between probe steps; an uncaught exception in the injected fetch script.
Related errors
- NotebookLM ${label} returned a malformed Browser Bridge payl
- NotebookLM page auth probe returned malformed fields
- Failed to open NotebookLM home: ${error?.message || error}
- NotebookLM page-state probe returned malformed Browser Bridg
- NotebookLM page-state probe returned an invalid URL
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/4bed5687876d4db1.
Report an issue: GitHub.