{"record":{"id":"7d63f656bcb169c3","repo":"jackwener/OpenCLI","slug":"content-exceeds-max-content-len-characters-s","errorCode":null,"errorMessage":"--content exceeds ${MAX_CONTENT_LEN} characters; split into smaller notes.","messagePattern":"--content exceeds (.+?) characters; split into smaller notes\\.","errorType":"validation","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"clis/notebooklm/write-note.js","lineNumber":26,"sourceCode":"const NOTEBOOKLM_MUTATE_NOTE_RPC_ID = 'cYAfTb';\nconst MAX_TITLE_LEN = 200;\nconst MAX_CONTENT_LEN = 1_000_000;\nconst NOTE_UUID_RE = /^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/i;\n\nexport function parseNoteTitle(value) {\n    const title = String(value ?? '').trim();\n    if (!title) throw new ArgumentError('--title is required');\n    if (title.length > MAX_TITLE_LEN) {\n        throw new ArgumentError(`--title must be at most ${MAX_TITLE_LEN} characters (got ${title.length})`);\n    }\n    return title;\n}\n\nexport function parseNoteContent(value) {\n    const content = String(value ?? '');\n    if (!content) throw new ArgumentError('--content is required');\n    if (content.length > MAX_CONTENT_LEN) {\n        throw new ArgumentError(`--content exceeds ${MAX_CONTENT_LEN} characters; split into smaller notes.`);\n    }\n    return content;\n}\n\nexport function buildCreateNoteShellArgs(projectId) {\n    return [projectId, '', [1], null, 'New Note', null, [2]];\n}\n\nexport function buildMutateNoteArgs(projectId, noteId, content, title) {\n    return [projectId, noteId, [[[content, title, [], 0]]], [2]];\n}\n\nfunction toExcludedUuidSet(excludedIds) {\n    return new Set(excludedIds.map((id) => String(id ?? '').toLowerCase()).filter(Boolean));\n}\n\nexport function parseNoteIdFromResult(result, excludedIds = []) {\n    const excluded = toExcludedUuidSet(excludedIds);","sourceCodeStart":8,"sourceCodeEnd":44,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/notebooklm/write-note.js#L8-L44","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Trim or split the content so it is at most 1,000,000 characters and write multiple notes","Check content.length before calling (content.length <= 1000000)","Strip unneeded whitespace/binary noise from the source text first","If large payloads are needed, create several notes and reference them instead"],"exampleFix":"// before\nconst content = fs.readFileSync('big.md', 'utf8');\nawait cliRun('notebooklm write-note', { notebook: id, title, content });\n// after\nconst full = fs.readFileSync('big.md', 'utf8');\nconst MAX = 1_000_000;\nconst chunks = full.match(new RegExp(`[\\\\s\\\\S]{1,${MAX}}`, 'g')) || [];\nfor (const [i, chunk] of chunks.entries()) {\n  await cliRun('notebooklm write-note', { notebook: id, title: `${title} (${i + 1}/${chunks.length})`, content: chunk });\n}","handlingStrategy":"validation","validationCode":"const content = String(raw ?? '');\nif (!content) throw new Error('--content is required');\nif (content.length > 1_000_000) {\n  throw new Error(`content too long (${content.length}); split into chunks of <= 1000000 chars`);\n}","typeGuard":"function isAcceptableContent(v) {\n  const s = String(v ?? '');\n  return s.length > 0 && s.length <= 1_000_000;\n}","tryCatchPattern":"try {\n  await writeNote({ notebook, title, content });\n} catch (e) {\n  if (/exceeds 1000000 characters/.test(e.message)) {\n    console.error('Content too large; split it into smaller notes.');\n  } else throw e;\n}","preventionTips":["Check content.length against 1,000,000 before invoking write-note","Split large documents into multiple notes with indexed titles","Validate input early in scripts, before any network/browser work"],"tags":["argument-validation","input-size-limit","notebooklm"],"backgroundTag":"input-size-limit-exceeded","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}