jackwener/OpenCLI · error · ArgumentError
Refusing to ${action}: pass --execute to perform this Notebo
Error message
Refusing to ${action}: pass --execute to perform this NotebookLM write What it means
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.
Source
Thrown at clis/notebooklm/utils.js:80
}
catch (error) {
if (error instanceof CliError)
throw error;
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.');
}
}
const pathMatch = normalized.match(/(?:^|\/)notebook\/([^/?#]+)/);
if (pathMatch?.[1])
return ensureNotebookUuid(pathMatch[1]);
return ensureNotebookUuid(normalized);
}
export function getNotebooklmAuthuser() {
const v = process.env.OPENCLI_NOTEBOOKLM_AUTHUSER;
return typeof v === 'string' && /^\d+$/.test(v) ? v : '';
}
export function requireNotebooklmExecute(value, action) {
if (value !== true) {
throw new ArgumentError(`Refusing to ${action}: pass --execute to perform this NotebookLM write`);
}
}
export function buildNotebooklmNotebookUrl(notebookId, observedUrl = '') {
const observed = parseTrustedNotebooklmUrl(observedUrl);
const base = observed ? `${observed.origin}/` : NOTEBOOKLM_HOME_URL;
const u = new URL(`/notebook/${encodeURIComponent(notebookId)}`, base);
const authuser = getNotebooklmAuthuser();
if (authuser) u.searchParams.set('authuser', authuser);
return u.toString();
}
export function classifyNotebooklmPage(url) {
const parsed = parseTrustedNotebooklmUrl(url);
if (!parsed)
return 'unknown';
if (/^\/notebook\/[^/]+\/?$/.test(parsed.pathname))
return 'notebook';
return 'home';
}View on GitHub (pinned to 49907e53dc)
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
Example fix
// before opencli notebooklm delete <notebook-id> // after opencli notebooklm delete <notebook-id> --execute
Defensive patterns
Strategy: validation
Validate before calling
if (!argv.execute) {
console.error('This is a write operation; re-run with --execute to apply it.');
process.exit(2);
} Try / catch
try {
opencli.notebooklm.deleteNotebook(id, { execute: true });
} catch (e) {
if (e instanceof ArgumentError && /--execute/.test(e.message)) {
console.error('Write refused: re-run with --execute to confirm.');
} else throw e;
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- <train-no> must not be empty
- ${commandName} requires --execute to perform a remote write
- kind
- direction
- Refusing to post: pass --execute to actually publish this co
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/78843231ff731769.
Report an issue: GitHub.