jackwener/OpenCLI · error · CommandExecutionError
NotebookLM page-state probe returned an invalid URL
Error message
NotebookLM page-state probe returned an invalid URL
What it means
After the page-state probe passes shape validation, the code attempts new URL(raw.url); if the URL string returned by the in-page probe cannot be parsed, this CommandExecutionError is thrown. The probe's url field should always be window.location.href, so an unparseable value means the probe returned corrupted or fabricated data.
Solutions
- Reload the page and re-run the probe — transient navigation states often resolve
- Log raw.url at the failure point to see what the probe actually returned
- Ensure no extensions/proxies rewrite window.location on the page
- Verify the probe script reads window.location.href (update library if NotebookLM changed)
- Navigate explicitly to the NotebookLM home URL before probing
Example fix
// before
const state = await getNotebooklmPageState(page);
// after: validate URL parseability defensively
const state = await getNotebooklmPageState(page);
let parsed;
try { parsed = new URL(state.url); }
catch {
await page.goto('https://notebooklm.google.com/');
// re-fetch state after a known-good navigation
}
Defensive patterns
Strategy: type-guard
Validate before calling
function isParseableUrl(u) {
try { new URL(u); return true; } catch { return false; }
}
// after obtaining state:
if (!isParseableUrl(state.url)) {
await page.goto('https://notebooklm.google.com/'); // recover before proceeding
} Type guard
function isAbsoluteUrl(v) {
if (typeof v !== 'string') return false;
try { const u = new URL(v); return u.protocol === 'https:'; } catch { return false; }
} Try / catch
try {
const state = await getNotebooklmPageState(page);
} catch (e) {
if (!/invalid URL/.test(e.message)) throw e;
await page.goto('https://notebooklm.google.com/');
const state = await getNotebooklmPageState(page); // re-probe after known-good navigation
} Prevention
- Log the raw url value when this fires to spot rewriting by extensions/proxies
- Navigate explicitly to a known-good NotebookLM URL before probing
- Disable location-rewriting browser extensions in automation environments
- Validate URL parseability immediately after receiving probe data
- Re-probe after redirects settle (login flows change location)
When it happens
Trigger: getNotebooklmPageState receiving raw.url that is not a valid absolute URL — e.g. an empty string, a relative path, or injected/intercepted navigation states where location.href is unusual; only reachable after the typeof check passed, so the string exists but is malformed.
Common situations: Browser stuck on a synthetic/interstitial page with odd location values; proxy or extension rewriting location.href; a library/NotebookLM change that makes the probe read a wrong variable for url.
Related errors
- NotebookLM page-state probe returned inconsistent URL and…
- NotebookLM page-state probe returned malformed Browser…
- Failed to open NotebookLM home
- NotebookLM current-page probe returned an untrusted or…
- NotebookLM current-page probe returned malformed Browser…
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/20f828a4cccf39e6.
Report an issue: GitHub.
Appendix: source
Thrown at clis/notebooklm/utils.js:678
text.includes('登入')
);
const notebookCount = Array.from(document.querySelectorAll('a[href*="/notebook/"]'))
.map(node => node instanceof HTMLAnchorElement ? node.href : '')
.filter(Boolean)
.reduce((count, href, index, list) => list.indexOf(href) === index ? count + 1 : count, 0);
return { url, title, hostname, kind, notebookId, loginRequired, notebookCount, path };
})()`, 'page-state probe');
if (!isPlainObject(raw) || typeof raw.url !== 'string' || typeof raw.title !== 'string' || typeof raw.hostname !== 'string' || typeof raw.kind !== 'string' || typeof raw.notebookId !== 'string' || typeof raw.loginRequired !== 'boolean' || typeof raw.notebookCount !== 'number' || !Number.isFinite(raw.notebookCount)) {
throw new CommandExecutionError('NotebookLM page-state probe returned malformed Browser Bridge data');
}
let parsed;
try {
parsed = new URL(raw.url);
}
catch {
throw new CommandExecutionError('NotebookLM page-state probe returned an invalid URL');
}
if (parsed.hostname !== raw.hostname) {
throw new CommandExecutionError('NotebookLM page-state probe returned inconsistent URL and hostname fields');
}
const trusted = parseTrustedNotebooklmUrl(parsed.href);
const kind = trusted ? classifyNotebooklmPage(trusted.href) : 'unknown';
const notebookId = kind === 'notebook' ? parseNotebooklmIdFromUrl(trusted.href) : '';
const loginPath = Boolean(trusted && (trusted.pathname === '/login' || trusted.pathname.startsWith('/login/')));
const state = {
url: raw.url,
title: normalizeNotebooklmTitle(raw?.title, 'NotebookLM'),
hostname: raw.hostname,
kind,
notebookId,
loginRequired: loginPath || raw.loginRequired,
notebookCount: Math.max(0, raw.notebookCount),
};
// Notebook pages can still contain "sign in" or login-related text fragmentsView on GitHub (pinned to 49907e53dc)