{"record":{"id":"a2b0d7a51226e41f","repo":"jackwener/OpenCLI","slug":"notebooklm-current-page-probe-returned-an-untruste","errorCode":null,"errorMessage":"NotebookLM current-page probe returned an untrusted or mismatched notebook URL","messagePattern":"NotebookLM current-page probe returned an untrusted or mismatched notebook URL","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/notebooklm/utils.js","lineNumber":732,"sourceCode":"    if (!match) return null;\n\n    const titleNode = document.querySelector('h1, [data-testid=\"notebook-title\"], [role=\"heading\"]');\n    const title = (titleNode?.textContent || document.title || '').trim();\n    return {\n      id: match[1],\n      title,\n      url,\n      source: 'current-page',\n    };\n  })()`, 'current-page probe');\n    if (!raw)\n        return null;\n    if (!isPlainObject(raw) || typeof raw.id !== 'string' || typeof raw.title !== 'string' || typeof raw.url !== 'string') {\n        throw new CommandExecutionError('NotebookLM current-page probe returned malformed Browser Bridge data');\n    }\n    const url = normalizeNotebooklmNotebookUrl(raw.url, raw.id);\n    if (!url) {\n        throw new CommandExecutionError('NotebookLM current-page probe returned an untrusted or mismatched notebook URL');\n    }\n    return {\n        id: raw.id,\n        title: normalizeNotebooklmTitle(raw.title, 'Untitled Notebook'),\n        url,\n        source: 'current-page',\n        is_owner: true,\n        created_at: null,\n    };\n}\nexport async function listNotebooklmLinks(page) {\n    const raw = await evaluateNotebooklm(page, `(() => {\n    const rows = [];\n    const seen = new Set();\n\n    for (const node of Array.from(document.querySelectorAll('a[href*=\"/notebook/\"]'))) {\n      if (!(node instanceof HTMLAnchorElement)) continue;\n      const href = node.href || '';","sourceCodeStart":714,"sourceCodeEnd":750,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/notebooklm/utils.js#L714-L750","documentation":"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.","triggerScenarios":"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.","commonSituations":"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).","solutions":["Navigate the active tab to the NotebookLM notebook itself (https://notebooklm.google.com/notebook/<id>) and retry.","Confirm the notebook id in the URL matches the notebook you expect; reload the page if you recently switched notebooks.","Log in fully — intermediate Google login/consent pages produce untrusted URLs.","If it persists after a reload, the page DOM/URL may have changed; update the CLI."],"exampleFix":"// before: acting on whatever URL the probe returned\nawait openNotebook(probe.url);\n\n// after: validate first\nimport { parseTrustedNotebooklmUrl } from 'clis/notebooklm/utils.js';\nif (!parseTrustedNotebooklmUrl(currentTabUrl)) {\n  throw new Error('Focus a trusted NotebookLM notebook tab before running this command.');\n}","handlingStrategy":"validation","validationCode":"const trusted = parseTrustedNotebooklmUrl(currentTabUrl);\nif (!trusted) throw new Error('Focus a trusted NotebookLM notebook tab (notebooklm.google.com/notebook/<id>) first.');","typeGuard":"const isTrustedNotebookUrl = (u) => typeof u === 'string' && /^https:\\/\\/notebooklm\\.google\\.com\\/notebook\\/[a-z0-9-]+/i.test(u);","tryCatchPattern":"try {\n  const page = await probeCurrentPage();\n} catch (e) {\n  if (String(e.message).includes('untrusted or mismatched notebook URL')) {\n    console.error('Navigate the active tab to the NotebookLM notebook itself and retry.');\n  } else { throw e; }\n}","preventionTips":["Confirm the URL's notebook id matches the notebook you intend to target.","Complete any Google login/consent screens before probing.","Reload the page after switching notebooks to avoid stale id/url pairs.","Validate URLs with parseTrustedNotebooklmUrl before any automation step."],"tags":["notebooklm","url-validation","untrusted-url","browser-bridge"],"backgroundTag":"untrusted-url-rejected","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}