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

  1. Re-run the command with the --execute flag to confirm the write
  2. Verify the flag is spelled exactly --execute with no =value form that could yield a non-true value
  3. 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

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


AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29). Data as JSON: /api/errors/78843231ff731769. Report an issue: GitHub.