jackwener/OpenCLI · error · CliError
NOTEBOOKLM_RPC_SCHEMA
NOTEBOOKLM_RPC_SCHEMA
Error message
NotebookLM RPC ${rpcId} returned malformed JSON What it means
When the matching 'wrb.fr' frame for the requested rpcId is found, its payload is expected to be a JSON string (or already-parsed value). If JSON.parse of the string payload throws, the library raises CliError code NOTEBOOKLM_RPC_SCHEMA indicating the response body is not parseable JSON — the internal response shape or encoding changed. This is a contract violation between the page's RPC layer and the CLI's parser.
Source
Thrown at clis/notebooklm/rpc.js:169
if (item[0] === 'er') {
const errorCode = typeof item[2] === 'number'
? item[2]
: typeof item[5] === 'number'
? item[5]
: null;
if (errorCode === 401 || errorCode === 403) {
throw new AuthRequiredError(NOTEBOOKLM_DOMAIN, `NotebookLM RPC returned auth error (${errorCode})`);
}
throw new CliError('NOTEBOOKLM_RPC', `NotebookLM RPC failed${errorCode ? ` (code=${errorCode})` : ''}`, 'Retry from an already logged-in NotebookLM session, or inspect the raw response with debug logging.');
}
if (item[0] === 'wrb.fr' && item[1] === rpcId) {
const payload = item[2];
if (typeof payload === 'string') {
try {
return JSON.parse(payload);
}
catch {
throw new CliError('NOTEBOOKLM_RPC_SCHEMA', `NotebookLM RPC ${rpcId} returned malformed JSON`, 'Retry from the NotebookLM page; the internal RPC response shape may have changed.');
}
}
return payload;
}
}
}
throw new CliError('NOTEBOOKLM_RPC_SCHEMA', `NotebookLM RPC ${rpcId} returned no matching response frame`, 'Retry from the NotebookLM page; the internal RPC response shape may have changed.');
}
export async function fetchNotebooklmInPage(page, url, options = {}) {
const method = options.method ?? 'GET';
const headers = options.headers ?? {};
const body = options.body ?? '';
let evaluated;
try {
evaluated = await page.evaluate(`(async () => {
const request = {
url: ${JSON.stringify(url)},
method: ${JSON.stringify(method)},View on GitHub (pinned to 49907e53dc)
Solutions
- Retry from a stable connection — truncation/corruption is often transient
- Enable debug logging to capture the raw payload and see why it fails to parse
- Update the CLI if NotebookLM changed its internal response encoding
- Check proxies/VPN that might rewrite or truncate response bodies
Example fix
// before (parsing without protection)
const data = JSON.parse(payload);
// after (tolerant parse)
let data;
try { data = JSON.parse(payload); } catch { throw new Error('malformed rpc payload: ' + payload.slice(0, 80)); } Defensive patterns
Strategy: retry
Validate before calling
// retry only parse failures; bail on others const result = await withRetry(3, () => callNotebooklmRpc(page, rpcId, payload), e => e.code === 'NOTEBOOKLM_RPC_SCHEMA');
Type guard
function isSchemaParseError(e) {
return e instanceof Error && e.code === 'NOTEBOOKLM_RPC_SCHEMA' && /malformed JSON/.test(e.message);
} Try / catch
try {
data = await callNotebooklmRpc(page, rpcId, payload);
} catch (e) {
if (isSchemaParseError(e)) {
console.error('Malformed JSON from RPC — check network/proxy truncation and CLI version.');
} else throw e;
} Prevention
- Use a stable connection; avoid proxies that truncate/rewrite responses
- Retry once on parse failures — truncation is often transient
- Update the CLI when the error recurs, as encoding changes accompany frontend updates
When it happens
Trigger: extractNotebooklmRpcResult finds item[0]==='wrb.fr' && item[1]===rpcId, payload is a string, but JSON.parse(payload) throws — truncated response, HTML error page embedded as payload, or a serialization change in the frame.
Common situations: Response truncated by a proxy or flaky network; Google served an HTML error/interstitial inside the frame; NotebookLM frontend update changed payload encoding; character-set issues mangling the JSON.
Understand the failure class
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
Related errors
- 12306 ${endpoint} returned an unexpected payload shape
- ${label} returned an unexpected payload shape; expected an o
- archive snapshots returned malformed CDX payload: top-level
- archive snapshots returned malformed CDX payload: header row
- archive snapshots returned malformed CDX payload: snapshot r
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/19fa7907482cdade.
Report an issue: GitHub.