jackwener/OpenCLI · error · ArgumentError

--title must be at most ${MAX_TITLE_LEN} characters (got ${t

Error message

--title must be at most ${MAX_TITLE_LEN} characters (got ${title.length})

What it means

parseNoteTitle enforces MAX_TITLE_LEN (200 characters) on the trimmed --title value. Titles longer than the limit are rejected with ArgumentError reporting both the cap and the actual length, keeping note titles within NotebookLM/UI-friendly bounds.

Source

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

import { cli, Strategy } from '@jackwener/opencli/registry';
import { ArgumentError, CommandExecutionError } from '@jackwener/opencli/errors';
import { NOTEBOOKLM_DOMAIN, NOTEBOOKLM_SITE } from './shared.js';
import { callNotebooklmRpc } from './rpc.js';
import { buildNotebooklmNotebookUrl, ensureNotebooklmHome, parseNotebooklmNotebookTarget, requireNotebooklmExecute, requireNotebooklmSession } from './utils.js';

const NOTEBOOKLM_CREATE_NOTE_RPC_ID = 'CYK0Xb';
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) {

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Shorten the title to 200 characters or fewer.
  2. Truncate programmatically before calling: title.slice(0, 200).
  3. Move long descriptive text into --content and keep --title a short label.
  4. Validate length in your script before invoking the command to get a friendlier message.

Example fix

// before
await writeNote({ title: longSummary, content });

// after
const title = longSummary.trim().slice(0, 200);
await writeNote({ title, content: longSummary + '\n\n' + content });
Defensive patterns

Strategy: validation

Validate before calling

const MAX_TITLE_LEN = 200;
if (title.trim().length > MAX_TITLE_LEN) {
  throw new Error(`--title must be at most ${MAX_TITLE_LEN} characters`);
}

Type guard

const isAcceptableTitle = (v) => typeof v === 'string' && v.trim().length > 0 && v.trim().length <= 200;

Try / catch

try {
  await writeNote({ title, content });
} catch (e) {
  const m = String(e.message).match(/--title must be at most (\d+) characters \(got (\d+)\)/);
  if (m) {
    console.error(`Shorten the title by ${Number(m[2]) - Number(m[1])} characters.`);
    process.exit(2);
  }
  throw e;
}

Prevention

When it happens

Trigger: Passing a --title whose trimmed length exceeds 200 characters — e.g. piping a whole sentence/paragraph, a generated summary, or a filename-heavy path as the title.

Common situations: Scripts that substitute document content for the title, templated titles with long prefixes, or non-Latin text where users misjudge character counts.

Related errors


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