jackwener/OpenCLI · error · CommandExecutionError

NotebookLM current-page probe returned an untrusted or…

Error message

NotebookLM current-page probe returned an untrusted or mismatched notebook URL

What it means

After the current-page probe returns well-formed data, the raw URL is passed through normalizeNotebooklmNotebookUrl, which only accepts trusted NotebookLM notebook URLs whose notebook id matches the reported id. If normalization fails (wrong host, non-notebook path, or id mismatch), the CLI refuses to trust the page and throws this CommandExecutionError to prevent acting on an unverified URL.

Solutions

  1. Navigate the active tab to the NotebookLM notebook itself (https://notebooklm.google.com/notebook/<id>) and retry.
  2. Confirm the notebook id in the URL matches the notebook you expect; reload the page if you recently switched notebooks.
  3. Log in fully — intermediate Google login/consent pages produce untrusted URLs.
  4. If it persists after a reload, the page DOM/URL may have changed; update the CLI.

Example fix

// before: acting on whatever URL the probe returned
await openNotebook(probe.url);

// after: validate first
import { parseTrustedNotebooklmUrl } from 'clis/notebooklm/utils.js';
if (!parseTrustedNotebooklmUrl(currentTabUrl)) {
  throw new Error('Focus a trusted NotebookLM notebook tab before running this command.');
}
Defensive patterns

Strategy: validation

Validate before calling

const trusted = parseTrustedNotebooklmUrl(currentTabUrl);
if (!trusted) throw new Error('Focus a trusted NotebookLM notebook tab (notebooklm.google.com/notebook/<id>) first.');

Type guard

const isTrustedNotebookUrl = (u) => typeof u === 'string' && /^https:\/\/notebooklm\.google\.com\/notebook\/[a-z0-9-]+/i.test(u);

Try / catch

try {
  const page = await probeCurrentPage();
} catch (e) {
  if (String(e.message).includes('untrusted or mismatched notebook URL')) {
    console.error('Navigate the active tab to the NotebookLM notebook itself and retry.');
  } else { throw e; }
}

Prevention

When it happens

Trigger: raw.url is a non-NotebookLM URL, a different Google property, a notebook URL whose id does not equal raw.id, or a relative/garbage string that normalizeNotebooklmNotebookUrl cannot map to a trusted notebook URL.

Common situations: User has the wrong tab focused (e.g. a Google Docs page), NotebookLM redirected to a login/consent screen, or the page reports an id that differs from the URL (stale cache, SPA navigation mid-probe).

Related errors


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

Appendix: source

Thrown at clis/notebooklm/utils.js:732

    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();

    for (const node of Array.from(document.querySelectorAll('a[href*="/notebook/"]'))) {
      if (!(node instanceof HTMLAnchorElement)) continue;
      const href = node.href || '';

View on GitHub (pinned to 49907e53dc)