jackwener/OpenCLI · error · ArgumentError

--content exceeds ${MAX_CONTENT_LEN} characters; split into

Error message

--content exceeds ${MAX_CONTENT_LEN} characters; split into smaller notes.

What it means

parseNoteContent validates the --content argument for the NotebookLM write-note command. It rejects content longer than MAX_CONTENT_LEN (1,000,000 characters) with an ArgumentError before any browser or RPC work happens. The library enforces this client-side guard because a single Studio note has a practical size limit and huge payloads would make the mutate RPC slow or fail server-side.

Source

Thrown at clis/notebooklm/write-note.js:26

const NOTEBOOKLM_MUTATE_NOTE_RPC_ID = 'cYAfTb';
const MAX_TITLE_LEN = 200;
const MAX_CONTENT_LEN = 1_000_000;
const NOTE_UUID_RE = /^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/i;

export function parseNoteTitle(value) {
    const title = String(value ?? '').trim();
    if (!title) throw new ArgumentError('--title is required');
    if (title.length > MAX_TITLE_LEN) {
        throw new ArgumentError(`--title must be at most ${MAX_TITLE_LEN} characters (got ${title.length})`);
    }
    return title;
}

export function parseNoteContent(value) {
    const content = String(value ?? '');
    if (!content) throw new ArgumentError('--content is required');
    if (content.length > MAX_CONTENT_LEN) {
        throw new ArgumentError(`--content exceeds ${MAX_CONTENT_LEN} characters; split into smaller notes.`);
    }
    return content;
}

export function buildCreateNoteShellArgs(projectId) {
    return [projectId, '', [1], null, 'New Note', null, [2]];
}

export function buildMutateNoteArgs(projectId, noteId, content, title) {
    return [projectId, noteId, [[[content, title, [], 0]]], [2]];
}

function toExcludedUuidSet(excludedIds) {
    return new Set(excludedIds.map((id) => String(id ?? '').toLowerCase()).filter(Boolean));
}

export function parseNoteIdFromResult(result, excludedIds = []) {
    const excluded = toExcludedUuidSet(excludedIds);

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Trim or split the content so it is at most 1,000,000 characters and write multiple notes
  2. Check content.length before calling (content.length <= 1000000)
  3. Strip unneeded whitespace/binary noise from the source text first
  4. If large payloads are needed, create several notes and reference them instead

Example fix

// before
const content = fs.readFileSync('big.md', 'utf8');
await cliRun('notebooklm write-note', { notebook: id, title, content });
// after
const full = fs.readFileSync('big.md', 'utf8');
const MAX = 1_000_000;
const chunks = full.match(new RegExp(`[\\s\\S]{1,${MAX}}`, 'g')) || [];
for (const [i, chunk] of chunks.entries()) {
  await cliRun('notebooklm write-note', { notebook: id, title: `${title} (${i + 1}/${chunks.length})`, content: chunk });
}
Defensive patterns

Strategy: validation

Validate before calling

const content = String(raw ?? '');
if (!content) throw new Error('--content is required');
if (content.length > 1_000_000) {
  throw new Error(`content too long (${content.length}); split into chunks of <= 1000000 chars`);
}

Type guard

function isAcceptableContent(v) {
  const s = String(v ?? '');
  return s.length > 0 && s.length <= 1_000_000;
}

Try / catch

try {
  await writeNote({ notebook, title, content });
} catch (e) {
  if (/exceeds 1000000 characters/.test(e.message)) {
    console.error('Content too large; split it into smaller notes.');
  } else throw e;
}

Prevention

When it happens

Trigger: Calling `write-note` (or parseNoteContent directly) with a --content string whose .length exceeds 1,000,000 characters; e.g. piping an entire large document/file into the note body.

Common situations: Importing a large Markdown export, a big log file, or concatenated notes into one note; scripts that read a file wholesale without truncating; users assuming notes have unlimited size.

Related errors


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