{"record":{"id":"78843231ff731769","repo":"jackwener/OpenCLI","slug":"refusing-to-action-pass-execute-to-perform-t","errorCode":null,"errorMessage":"Refusing to ${action}: pass --execute to perform this NotebookLM write","messagePattern":"Refusing to (.+?): pass --execute to perform this NotebookLM write","errorType":"validation","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"clis/notebooklm/utils.js","lineNumber":80,"sourceCode":"        }\n        catch (error) {\n            if (error instanceof CliError)\n                throw error;\n            throw new CliError('NOTEBOOKLM_INVALID_NOTEBOOK', 'NotebookLM notebook URL contains an invalid encoded id', 'Pass a notebook id from `opencli notebooklm list` or a full NotebookLM notebook URL.');\n        }\n    }\n    const pathMatch = normalized.match(/(?:^|\\/)notebook\\/([^/?#]+)/);\n    if (pathMatch?.[1])\n        return ensureNotebookUuid(pathMatch[1]);\n    return ensureNotebookUuid(normalized);\n}\nexport function getNotebooklmAuthuser() {\n    const v = process.env.OPENCLI_NOTEBOOKLM_AUTHUSER;\n    return typeof v === 'string' && /^\\d+$/.test(v) ? v : '';\n}\nexport function requireNotebooklmExecute(value, action) {\n    if (value !== true) {\n        throw new ArgumentError(`Refusing to ${action}: pass --execute to perform this NotebookLM write`);\n    }\n}\nexport function buildNotebooklmNotebookUrl(notebookId, observedUrl = '') {\n    const observed = parseTrustedNotebooklmUrl(observedUrl);\n    const base = observed ? `${observed.origin}/` : NOTEBOOKLM_HOME_URL;\n    const u = new URL(`/notebook/${encodeURIComponent(notebookId)}`, base);\n    const authuser = getNotebooklmAuthuser();\n    if (authuser) u.searchParams.set('authuser', authuser);\n    return u.toString();\n}\nexport function classifyNotebooklmPage(url) {\n    const parsed = parseTrustedNotebooklmUrl(url);\n    if (!parsed)\n        return 'unknown';\n    if (/^\\/notebook\\/[^/]+\\/?$/.test(parsed.pathname))\n        return 'notebook';\n    return 'home';\n}","sourceCodeStart":62,"sourceCodeEnd":98,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/notebooklm/utils.js#L62-L98","documentation":"NotebookLM write operations are destructive by default: requireNotebooklmExecute throws an ArgumentError unless the caller explicitly passes value === true (wired to the --execute flag). This is a safety gate so read-only invocations never mutate notebooks. The interpolated `action` names the specific write being refused.","triggerScenarios":"Invoking any NotebookLM write command (delete, rename, source removal, etc.) without the --execute flag, so the flag value is not strictly true and requireNotebooklmExecute rejects it.","commonSituations":"Running a write command in scripts/CI without --execute; passing --execute=false or a truthy-but-not-boolean value; forgetting the flag when chaining commands after read-only ones.","solutions":["Re-run the command with the --execute flag to confirm the write","Verify the flag is spelled exactly --execute with no =value form that could yield a non-true value","For scripting, add --execute only after validating the target notebook is correct"],"exampleFix":"// before\nopencli notebooklm delete <notebook-id>\n// after\nopencli notebooklm delete <notebook-id> --execute","handlingStrategy":"validation","validationCode":"if (!argv.execute) {\n  console.error('This is a write operation; re-run with --execute to apply it.');\n  process.exit(2);\n}","typeGuard":null,"tryCatchPattern":"try {\n  opencli.notebooklm.deleteNotebook(id, { execute: true });\n} catch (e) {\n  if (e instanceof ArgumentError && /--execute/.test(e.message)) {\n    console.error('Write refused: re-run with --execute to confirm.');\n  } else throw e;\n}","preventionTips":["Always append --execute to NotebookLM write commands (delete, rename, source changes)","Do a dry run without --execute first to review the target, then add --execute","In CI, gate write commands behind an explicit approval variable that injects --execute","Never pass --execute=false or other value forms — only the bare flag counts as true"],"tags":["safety-guard","confirmation-flag","cli-usage","write-protection"],"backgroundTag":"missing-confirmation-flag","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}