jackwener/OpenCLI · error · CommandExecutionError

NotebookLM ${label} returned a malformed Browser Bridge payl

Error message

NotebookLM ${label} returned a malformed Browser Bridge payload

What it means

requireNotebooklmObject validates that a value evaluated inside the NotebookLM Chrome page via the Browser Bridge is a non-null, non-array plain object. When the in-page script returns nothing, a primitive, or an array instead of the expected object envelope, the helper throws this CommandExecutionError so downstream field access cannot proceed on garbage data. It is a shape contract at the transport boundary.

Source

Thrown at clis/notebooklm/rpc.js:8

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) {

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Reload the NotebookLM notebook page in Chrome and wait for full load before retrying
  2. Re-authenticate / open the notebook in an already logged-in session
  3. Retry with --verbose to inspect the raw evaluate payload
  4. Update the CLI, since a NotebookLM frontend change may have altered the payload envelope

Example fix

// before (fragile direct access)
const raw = await page.evaluate(() => collect());
console.log(raw.html);
// after (guard first)
const raw = await page.evaluate(() => collect());
if (!raw || typeof raw !== 'object' || Array.isArray(raw)) throw new Error('unexpected payload');
console.log(raw.html);
Defensive patterns

Strategy: type-guard

Validate before calling

const raw = unwrapNotebooklmEvaluateResult(evaluated);
if (!raw || typeof raw !== 'object' || Array.isArray(raw)) {
  throw new Error('Browser Bridge returned no object payload; reload the NotebookLM page');
}

Type guard

function isBridgeObject(v) {
  return v !== null && typeof v === 'object' && !Array.isArray(v);
}

Try / catch

try {
  const raw = unwrapNotebooklmEvaluateResult(evaluated);
  if (!isBridgeObject(raw)) throw new Error('malformed payload');
  // use raw
} catch (e) {
  console.error('Browser Bridge payload invalid, reload the notebook page:', e.message);
}

Prevention

When it happens

Trigger: requireNotebooklmObject(unwrapNotebooklmEvaluateResult(evaluated), 'page auth probe') returns null/undefined/an array/a string because the in-page evaluate failed to produce the expected {session,data} object, or unwrapNotebooklmEvaluateResult returned payload.data that is not an object.

Common situations: NotebookLM page not fully loaded so the injected script returns undefined; a NotebookLM frontend update changed the evaluate envelope shape; the page is on a redirect/login interstitial so the script short-circuits; stale Chrome session with a cached old script.

Understand the failure class

Related errors


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