jackwener/OpenCLI · error · CommandExecutionError

NotebookLM page auth probe returned malformed fields

Error message

NotebookLM page auth probe returned malformed fields

What it means

After confirming a trusted origin, probeNotebooklmPageAuth validates that the probe payload carries all required string fields: html, sourcePath, csrfToken, sessionId, and authuser. If any is missing or of the wrong type it throws this CommandExecutionError. The in-page collector returned an object, but not one with the full expected schema.

Source

Thrown at clis/notebooklm/rpc.js:64

      sourcePath: location.pathname || '/',
      readyState: document.readyState || '',
      csrfToken: typeof wiz.SNlM0e === 'string' ? wiz.SNlM0e : '',
      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);

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Hard-reload the NotebookLM page (Ctrl+Shift+R) so the collector script matches the current frontend
  2. Update the CLI so its in-page collector matches the current NotebookLM payload schema
  3. Retry with --verbose to log the raw probe object and identify the missing field
  4. If it persists after update, report the schema change; the collector keys likely need updating

Example fix

// before (trusting the probe shape)
const auth = await probeNotebooklmPageAuth(page);
fetch(url, { headers: { 'X- csrf': auth.csrfToken.toLowerCase() } });
// after (narrow before use)
const auth = await probeNotebooklmPageAuth(page);
if (typeof auth.csrfToken !== 'string' || !auth.csrfToken) throw new Error('probe missing csrfToken');
Defensive patterns

Strategy: type-guard

Validate before calling

function probeFieldsValid(raw) {
  return ['html','sourcePath','csrfToken','sessionId','authuser']
    .every(k => typeof raw?.[k] === 'string');
}

Type guard

function isProbeResult(r) {
  return r !== null && typeof r === 'object' &&
    typeof r.html === 'string' && typeof r.sourcePath === 'string' &&
    typeof r.csrfToken === 'string' && typeof r.sessionId === 'string' &&
    typeof r.authuser === 'string';
}

Try / catch

try {
  const auth = await probeNotebooklmPageAuth(page);
} catch (e) {
  if (/malformed fields/.test(e.message)) {
    console.error('Probe schema mismatch — hard reload the page and update the CLI.');
  } else throw e;
}

Prevention

When it happens

Trigger: requireNotebooklmObject passed but raw.html/raw.sourcePath/raw.csrfToken/raw.sessionId/raw.authuser is not a string — e.g. a NotebookLM frontend update changed the collector script's return keys, or one field came back undefined/null/number.

Common situations: NotebookLM shipped a UI update that renamed or dropped one of the collected fields; the injected collector script is an older cached version than the page; a partial page load left html collected but tokens undefined.

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.

Related errors


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