jackwener/OpenCLI · error · CommandExecutionError

NotebookLM page auth probe returned an invalid path or authu

Error message

NotebookLM page auth probe returned an invalid path or authuser

What it means

This is the probe's consistency check: the reported sourcePath must equal the pathname of the already-validated trusted page URL, and authuser, when non-empty, must be all digits. A mismatch means the evaluated payload does not actually correspond to the page the browser is on, so probeNotebooklmPageAuth throws this CommandExecutionError rather than return credentials for the wrong context.

Source

Thrown at clis/notebooklm/rpc.js:67

      sessionId: typeof wiz.FdrFJe === 'string' ? wiz.FdrFJe : '',
      authuser: authMatch ? authMatch[1] : (pathMatch ? pathMatch[1] : ''),
      url: location.href,
    };
  })()`);
    }
    catch (error) {
        rethrowNotebooklmTransport(error, 'page auth probe');
    }
    const raw = requireNotebooklmObject(unwrapNotebooklmEvaluateResult(evaluated), 'page auth probe');
    const pageUrl = parseTrustedNotebooklmUrl(raw.url);
    if (!pageUrl) {
        throw new CommandExecutionError('NotebookLM page auth probe is not on a trusted HTTPS NotebookLM origin');
    }
    if (typeof raw.html !== 'string' || typeof raw.sourcePath !== 'string' || typeof raw.csrfToken !== 'string' || typeof raw.sessionId !== 'string' || typeof raw.authuser !== 'string') {
        throw new CommandExecutionError('NotebookLM page auth probe returned malformed fields');
    }
    if (raw.sourcePath !== pageUrl.pathname || (raw.authuser && !/^\d+$/.test(raw.authuser))) {
        throw new CommandExecutionError('NotebookLM page auth probe returned an invalid path or authuser');
    }
    return {
        html: raw.html,
        sourcePath: raw.sourcePath,
        readyState: typeof raw.readyState === 'string' ? raw.readyState : '',
        csrfToken: raw.csrfToken,
        sessionId: raw.sessionId,
        authuser: raw.authuser,
        origin: pageUrl.origin,
    };
}
export async function getNotebooklmPageAuth(page) {
    let lastError;
    for (let attempt = 0; attempt < 2; attempt += 1) {
        const probe = await probeNotebooklmPageAuth(page);
        try {
            return {
                ...extractNotebooklmPageAuthFromHtml(probe.html, probe.sourcePath, { csrfToken: probe.csrfToken, sessionId: probe.sessionId, authuser: probe.authuser }),

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Re-run the probe — a mid-navigation race usually resolves on a stable, fully loaded page
  2. Wait for network idle on the notebook page before invoking the command
  3. Pass the numeric authuser explicitly via CLI flags so the expected value matches the page
  4. Disable extensions that rewrite navigation/URLs and retry

Example fix

// before (probing during navigation)
await page.click('.notebook-link');
const auth = await probeNotebooklmPageAuth(page);
// after (wait for navigation to settle)
await Promise.all([page.waitForNavigation({ waitUntil: 'networkidle' }), page.click('.notebook-link')]);
const auth = await probeNotebooklmPageAuth(page);
Defensive patterns

Strategy: retry

Validate before calling

const pageUrl = new URL(page.url());
if (await page.evaluate(() => document.readyState) !== 'complete') {
  await page.waitForNavigation({ waitUntil: 'networkidle' }).catch(() => {});
}

Type guard

function probePathMatches(raw, pageUrl) {
  return typeof raw.sourcePath === 'string' && raw.sourcePath === pageUrl.pathname &&
    (!raw.authuser || /^\d+$/.test(raw.authuser));
}

Try / catch

try {
  auth = await probeNotebooklmPageAuth(page);
} catch (e) {
  if (/invalid path or authuser/.test(e.message)) {
    await sleep(1500); // navigation race: retry once on a stable page
    auth = await probeNotebooklmPageAuth(page);
  } else throw e;
}

Prevention

When it happens

Trigger: probe() evaluates while a client-side redirect/navigation happens mid-probe (sourcePath from an older page vs pageUrl from the new URL), or the page sets authuser to a non-numeric value like '0@default' or a debug string.

Common situations: NotebookLM navigated between notebook views while the probe ran (race); a custom multi-account authuser parameter format changed; an extension injected a wrapper page altering location.pathname reporting.

Related errors


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