{"record":{"id":"22692b5be3e0bc3c","repo":"jackwener/OpenCLI","slug":"notebooklm-page-auth-probe-returned-malformed-fiel","errorCode":null,"errorMessage":"NotebookLM page auth probe returned malformed fields","messagePattern":"NotebookLM page auth probe returned malformed fields","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/notebooklm/rpc.js","lineNumber":64,"sourceCode":"      sourcePath: location.pathname || '/',\n      readyState: document.readyState || '',\n      csrfToken: typeof wiz.SNlM0e === 'string' ? wiz.SNlM0e : '',\n      sessionId: typeof wiz.FdrFJe === 'string' ? wiz.FdrFJe : '',\n      authuser: authMatch ? authMatch[1] : (pathMatch ? pathMatch[1] : ''),\n      url: location.href,\n    };\n  })()`);\n    }\n    catch (error) {\n        rethrowNotebooklmTransport(error, 'page auth probe');\n    }\n    const raw = requireNotebooklmObject(unwrapNotebooklmEvaluateResult(evaluated), 'page auth probe');\n    const pageUrl = parseTrustedNotebooklmUrl(raw.url);\n    if (!pageUrl) {\n        throw new CommandExecutionError('NotebookLM page auth probe is not on a trusted HTTPS NotebookLM origin');\n    }\n    if (typeof raw.html !== 'string' || typeof raw.sourcePath !== 'string' || typeof raw.csrfToken !== 'string' || typeof raw.sessionId !== 'string' || typeof raw.authuser !== 'string') {\n        throw new CommandExecutionError('NotebookLM page auth probe returned malformed fields');\n    }\n    if (raw.sourcePath !== pageUrl.pathname || (raw.authuser && !/^\\d+$/.test(raw.authuser))) {\n        throw new CommandExecutionError('NotebookLM page auth probe returned an invalid path or authuser');\n    }\n    return {\n        html: raw.html,\n        sourcePath: raw.sourcePath,\n        readyState: typeof raw.readyState === 'string' ? raw.readyState : '',\n        csrfToken: raw.csrfToken,\n        sessionId: raw.sessionId,\n        authuser: raw.authuser,\n        origin: pageUrl.origin,\n    };\n}\nexport async function getNotebooklmPageAuth(page) {\n    let lastError;\n    for (let attempt = 0; attempt < 2; attempt += 1) {\n        const probe = await probeNotebooklmPageAuth(page);","sourceCodeStart":46,"sourceCodeEnd":82,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/notebooklm/rpc.js#L46-L82","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Hard-reload the NotebookLM page (Ctrl+Shift+R) so the collector script matches the current frontend","Update the CLI so its in-page collector matches the current NotebookLM payload schema","Retry with --verbose to log the raw probe object and identify the missing field","If it persists after update, report the schema change; the collector keys likely need updating"],"exampleFix":"// before (trusting the probe shape)\nconst auth = await probeNotebooklmPageAuth(page);\nfetch(url, { headers: { 'X- csrf': auth.csrfToken.toLowerCase() } });\n// after (narrow before use)\nconst auth = await probeNotebooklmPageAuth(page);\nif (typeof auth.csrfToken !== 'string' || !auth.csrfToken) throw new Error('probe missing csrfToken');","handlingStrategy":"type-guard","validationCode":"function probeFieldsValid(raw) {\n  return ['html','sourcePath','csrfToken','sessionId','authuser']\n    .every(k => typeof raw?.[k] === 'string');\n}","typeGuard":"function isProbeResult(r) {\n  return r !== null && typeof r === 'object' &&\n    typeof r.html === 'string' && typeof r.sourcePath === 'string' &&\n    typeof r.csrfToken === 'string' && typeof r.sessionId === 'string' &&\n    typeof r.authuser === 'string';\n}","tryCatchPattern":"try {\n  const auth = await probeNotebooklmPageAuth(page);\n} catch (e) {\n  if (/malformed fields/.test(e.message)) {\n    console.error('Probe schema mismatch — hard reload the page and update the CLI.');\n  } else throw e;\n}","preventionTips":["Hard-reload (Ctrl+Shift+R) the notebook page after any NotebookLM update","Keep the CLI version current with the page collector script","Log the raw probe object when the error first appears to spot the missing field"],"tags":["schema-validation","browser-bridge","notebooklm"],"backgroundTag":"schema-validation-failed","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}