jackwener/OpenCLI · error · CommandExecutionError

NotebookLM RPC request resolved outside the active trusted o

Error message

NotebookLM RPC request resolved outside the active trusted origin

What it means

After the RPC call, callNotebooklmRpc parses response.requestUrl with parseTrustedNotebooklmUrl and asserts it stays on the authenticated origin (auth.origin) with the exact NOTEBOOKLM_RPC_PATH. If the URL cannot be parsed, points at a different origin, or a different path, the request did not land on the trusted endpoint, so it refuses to trust the response and throws this CommandExecutionError.

Source

Thrown at clis/notebooklm/rpc.js:243

    const auth = await getNotebooklmPageAuth(page);
    const requestBody = buildNotebooklmRpcBody(rpcId, params, auth.csrfToken);
    const authuser = auth.authuser || '';
    const url = NOTEBOOKLM_RPC_PATH +
        `?rpcids=${rpcId}&source-path=${encodeURIComponent(auth.sourcePath)}` +
        (authuser ? `&authuser=${encodeURIComponent(authuser)}` : '') +
        `&hl=${encodeURIComponent(options.hl ?? 'en')}` +
        `&f.sid=${encodeURIComponent(auth.sessionId)}&rt=c`;
    const response = await fetchNotebooklmInPage(page, url, {
        method: 'POST',
        headers: {
            'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8',
        },
        body: requestBody,
    });
    const requestUrl = parseTrustedNotebooklmUrl(response.requestUrl);
    const finalUrl = parseTrustedNotebooklmUrl(response.finalUrl);
    if (!requestUrl || requestUrl.origin !== auth.origin || requestUrl.pathname !== NOTEBOOKLM_RPC_PATH) {
        throw new CommandExecutionError('NotebookLM RPC request resolved outside the active trusted origin');
    }
    if (finalUrl?.origin === auth.origin && (finalUrl.pathname === '/login' || finalUrl.pathname.startsWith('/login/'))) {
        throw new AuthRequiredError(NOTEBOOKLM_DOMAIN, 'NotebookLM RPC redirected to the login page');
    }
    if (!finalUrl || finalUrl.origin !== auth.origin || finalUrl.pathname !== NOTEBOOKLM_RPC_PATH) {
        throw new CommandExecutionError('NotebookLM RPC response redirected outside the active trusted endpoint');
    }
    if (response.status === 401 || response.status === 403) {
        throw new AuthRequiredError(NOTEBOOKLM_DOMAIN, `NotebookLM RPC returned auth error (${response.status})`);
    }
    if (!response.ok) {
        throw new CliError('NOTEBOOKLM_RPC', `NotebookLM RPC request failed with HTTP ${response.status}`, 'Retry from the NotebookLM home page in an already logged-in Chrome session.');
    }
    return {
        auth,
        url: requestUrl.href,
        requestBody,
        response,

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Verify network egress: disable proxies/VPNs or exclude the NotebookLM domain from interception and retry.
  2. Log in directly at the NotebookLM origin in the attached Chrome profile, then re-run `opencli notebooklm open <notebook>`.
  3. Confirm response.requestUrl is an absolute URL; if the wrapper returns a relative URL, fix or upgrade the adapter code.
  4. If NotebookLM changed NOTEBOOKLM_RPC_PATH, update the constant to the new path and ensure parseTrustedNotebooklmUrl accepts the origin.
Defensive patterns

Strategy: validation

Validate before calling

const requestUrl = parseTrustedNotebooklmUrl(response.requestUrl);
if (!requestUrl || requestUrl.origin !== auth.origin || requestUrl.pathname !== NOTEBOOKLM_RPC_PATH) {
  throw new Error('RPC request URL is not on the trusted endpoint — check proxy/VPN/SSO settings before calling.');
}

Try / catch

try {
  const res = await callNotebooklmRpc(page, auth, method, body);
} catch (e) {
  if (e instanceof CommandExecutionError && e.message.includes('outside the active trusted origin')) {
    // disable proxy/VPN interception or re-login on the trusted origin, then retry
  } else throw e;
}

Prevention

When it happens

Trigger: The in-page fetch was redirected (proxy, captive portal, SSO bounce) to another origin; response.requestUrl is relative or absent (malformed envelope); the request path no longer matches NOTEBOOKLM_RPC_PATH because NotebookLM changed its batchexecute path.

Common situations: Corporate proxy or SSL-intercepting appliance rewriting the URL; the user is behind an SSO redirect chain that lands on a different domain; a VPN/captive portal serving a challenge page; an attacker/MITM scenario this check exists to catch; NotebookLM deploying a new RPC path in an updated frontend.

Related errors


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