jackwener/OpenCLI · error · CommandExecutionError

NotebookLM current-page probe returned malformed Browser Bri

Error message

NotebookLM current-page probe returned malformed Browser Bridge data

What it means

The current-page probe runs an in-page script via Browser Bridge to identify the active NotebookLM notebook. It expects the evaluated result to be a plain object with string id, title, and url fields. If the bridge returns null-primitive, non-object, or missing/incorrectly-typed fields, this CommandExecutionError is thrown instead of trusting unverified page data.

Source

Thrown at clis/notebooklm/utils.js:728

export async function readCurrentNotebooklm(page) {
    const raw = await evaluateNotebooklm(page, `(() => {
    const url = window.location.href;
    const match = url.match(/\\/notebook\\/([^/?#]+)/);
    if (!match) return null;

    const titleNode = document.querySelector('h1, [data-testid="notebook-title"], [role="heading"]');
    const title = (titleNode?.textContent || document.title || '').trim();
    return {
      id: match[1],
      title,
      url,
      source: 'current-page',
    };
  })()`, 'current-page probe');
    if (!raw)
        return null;
    if (!isPlainObject(raw) || typeof raw.id !== 'string' || typeof raw.title !== 'string' || typeof raw.url !== 'string') {
        throw new CommandExecutionError('NotebookLM current-page probe returned malformed Browser Bridge data');
    }
    const url = normalizeNotebooklmNotebookUrl(raw.url, raw.id);
    if (!url) {
        throw new CommandExecutionError('NotebookLM current-page probe returned an untrusted or mismatched notebook URL');
    }
    return {
        id: raw.id,
        title: normalizeNotebooklmTitle(raw.title, 'Untitled Notebook'),
        url,
        source: 'current-page',
        is_owner: true,
        created_at: null,
    };
}
export async function listNotebooklmLinks(page) {
    const raw = await evaluateNotebooklm(page, `(() => {
    const rows = [];
    const seen = new Set();

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Ensure the active Chrome tab is a loaded NotebookLM notebook page (URL matching the NotebookLM notebook pattern) before running the command.
  2. Re-run the command after the page fully loads; SPA hydration may not have completed on first attempt.
  3. Update the NotebookLM CLI and Browser Bridge extension to the latest versions to match current NotebookLM DOM.
  4. Verify the Browser Bridge connection (extension enabled, correct port/debug target) — a dead bridge often returns a malformed empty payload.

Example fix

// before: assuming probe always returns an object
const page = await probeCurrentPage();
console.log(page.id);

// after: guard and recover
let page = null;
try {
  page = await probeCurrentPage();
} catch (e) {
  if (String(e.message).includes('malformed Browser Bridge data')) {
    console.error('Open a NotebookLM notebook tab in Chrome and retry.');
  } else throw e;
}
Defensive patterns

Strategy: type-guard

Validate before calling

function looksLikePageProbe(v) {
  return v !== null && typeof v === 'object' &&
    typeof v.id === 'string' && v.id.length > 0 &&
    typeof v.title === 'string' &&
    typeof v.url === 'string' && v.url.startsWith('https://notebooklm.google.com/');
}

Type guard

const isPlainPageState = (v) => Object.prototype.toString.call(v) === '[object Object]' && typeof v.id === 'string' && typeof v.title === 'string' && typeof v.url === 'string';

Try / catch

try {
  const page = await probeCurrentPage();
} catch (e) {
  if (String(e.message).includes('malformed Browser Bridge data')) {
    console.error('Active tab is not a loaded NotebookLM notebook; open one and retry.');
  } else { throw e; }
}

Prevention

When it happens

Trigger: The injected probe script in the active tab returns something other than {id:string,title:string,url:string} — e.g. the evaluated snippet returns undefined, a JSON-parse failure wrapped object, or the page DOM changed so the selectors yield missing fields.

Common situations: The active Chrome tab is not a NotebookLM notebook page, the Browser Bridge extension/injection failed silently, a NotebookLM UI update changed the DOM the probe scrapes, or the probe ran before the SPA finished rendering.

Understand the failure class

Related errors


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