{"record":{"id":"acac78c71b9efcfb","repo":"jackwener/OpenCLI","slug":"notebooklm-action-post-write-verification-faile","errorCode":null,"errorMessage":"NotebookLM ${action} post-write verification failed: ${error?.message || error}","messagePattern":"NotebookLM (.+?) post-write verification failed: (.+?)","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/notebooklm/utils.js","lineNumber":483,"sourceCode":"    const rpc = await callNotebooklmRpc(page, NOTEBOOKLM_NOTEBOOK_DETAIL_RPC_ID, [state.notebookId, null, [2], null, 0]);\n    return parseNotebooklmNotebookDetailResult(rpc.result);\n}\nexport async function getNotebooklmNotebookDetailById(page, notebookId) {\n    const rpc = await callNotebooklmRpc(page, NOTEBOOKLM_NOTEBOOK_DETAIL_RPC_ID, [notebookId, null, [2], null, 0]);\n    return { detail: parseNotebooklmNotebookDetailResult(rpc.result), sources: parseNotebooklmSourceListResult(rpc.result) };\n}\nexport async function verifyNotebooklmNotebookExists(page, notebookId, action) {\n    try {\n        const { detail } = await getNotebooklmNotebookDetailById(page, notebookId);\n        if (!detail || detail.id !== notebookId) {\n            throw new CommandExecutionError(`NotebookLM ${action} succeeded but the notebook ${notebookId} was not found in the post-write verification`);\n        }\n        return detail;\n    }\n    catch (error) {\n        if (error instanceof AuthRequiredError || error instanceof CommandExecutionError)\n            throw error;\n        throw new CommandExecutionError(`NotebookLM ${action} post-write verification failed: ${error?.message || error}`);\n    }\n}\nexport async function verifyNotebooklmSourceAdded(page, notebookId, sourceId, action) {\n    try {\n        const { detail, sources } = await getNotebooklmNotebookDetailById(page, notebookId);\n        if (!detail || detail.id !== notebookId) {\n            throw new CommandExecutionError(`NotebookLM ${action} succeeded but the notebook ${notebookId} was not found in the post-write verification`);\n        }\n        const matched = sources.find((s) => s.id === sourceId);\n        if (!matched) {\n            throw new CommandExecutionError(`NotebookLM ${action} succeeded but source ${sourceId} did not appear in the notebook's source list`);\n        }\n        return matched;\n    }\n    catch (error) {\n        if (error instanceof AuthRequiredError || error instanceof CommandExecutionError)\n            throw error;\n        throw new CommandExecutionError(`NotebookLM ${action} post-write verification failed: ${error?.message || error}`);","sourceCodeStart":465,"sourceCodeEnd":501,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/notebooklm/utils.js#L465-L501","documentation":"Inside verifyNotebooklmNotebookExists, any error thrown while fetching or parsing the notebook detail that is not an AuthRequiredError or CommandExecutionError is wrapped into this CommandExecutionError with the original message appended. It means the post-write verification itself failed (network hiccup, malformed RPC payload, browser bridge failure), not necessarily that the notebook is missing.","triggerScenarios":"getNotebooklmNotebookDetailById throws during verification — e.g. evaluateNotebooklm/RPC transport failure, parseNotebooklmNotebookDetailResult hitting a schema change (null detail path throws differently), timeouts waiting for the page, or a non-auth browser error while the verify wrapper converts it.","commonSituations":"Flaky network or page navigation during verification; Browser Bridge disconnect mid-RPC; NotebookLM RPC schema change returning unexpected payloads; slow page load making the detail probe fail before data arrives.","solutions":["Inspect the inner error message appended after 'post-write verification failed:' to find the root cause","Retry the verification — transient transport failures often succeed on a second attempt","Reload the NotebookLM notebook page to re-establish page state before re-verifying","Re-authenticate if the session expired (check for login redirects)","Upgrade the library if NotebookLM changed its internal RPC schema"],"exampleFix":"// before: single-shot verify\nawait verifyNotebooklmNotebookExists(page, id, 'create');\n// after: tolerate transient verification failures\ntry {\n  await verifyNotebooklmNotebookExists(page, id, 'create');\n} catch (e) {\n  if (!/verification failed/.test(e.message)) throw e;\n  await page.wait(3);\n  await verifyNotebooklmNotebookExists(page, id, 'create');\n}","handlingStrategy":"retry","validationCode":"// ensure page is on a NotebookLM notebook URL before verification\nconst url = page.url();\nif (!/notebooklm\\.google\\.com\\/.+/.test(url)) {\n  throw new Error('Page not on NotebookLM; verification would fail');\n}","typeGuard":"function isTransientVerificationError(e) {\n  return /post-write verification failed/.test(String(e?.message));\n}","tryCatchPattern":"try {\n  await verifyNotebooklmNotebookExists(page, id, action);\n} catch (e) {\n  if (e instanceof AuthRequiredError || !isTransientVerificationError(e)) throw e;\n  await page.wait(2);\n  await verifyNotebooklmNotebookExists(page, id, action); // single retry\n}","preventionTips":["Read the appended inner error message to identify root causes","Retry transient transport failures before surfacing to users","Reload the notebook page to re-establish Browser Bridge state","Re-authenticate when inner messages indicate session loss","Track NotebookLM RPC schema changes via library releases"],"tags":["notebooklm","verification","wrapped-error","scraping"],"backgroundTag":"post-write-verification-failed","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}