{"record":{"id":"dda29902b362d2ee","repo":"jackwener/OpenCLI","slug":"content-is-required","errorCode":null,"errorMessage":"--content is required","messagePattern":"--content is required","errorType":"validation","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"clis/notebooklm/write-note.js","lineNumber":24,"sourceCode":"\nconst NOTEBOOKLM_CREATE_NOTE_RPC_ID = 'CYK0Xb';\nconst 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","sourceCodeStart":6,"sourceCodeEnd":42,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/notebooklm/write-note.js#L6-L42","documentation":"parseNoteContent validates the --content option for write-note: it stringifies the value and throws ArgumentError if the result is empty. Note content is mandatory, so the command fails fast before touching the browser.","triggerScenarios":"Calling write-note without --content, with an empty string, or with a value that stringifies to empty (undefined/null); also when a file/stdin read that was supposed to feed content returned nothing.","commonSituations":"Forgetting the flag, a file path typo making a read return empty, an empty stdin pipe in a pipeline, or shell variable expansion of an unset variable.","solutions":["Provide non-empty content via --content \"...\" or by piping text into the command.","Verify the file you read content from actually exists and is non-empty.","Check pipelines: ensure the upstream command emits data (e.g. cat file | write-note ...).","In scripts, assert content length > 0 before invoking write-note."],"exampleFix":"// before\nconst content = fs.readFileSync(path, 'utf8');\nawait writeNote({ title, content });\n\n// after\nconst content = fs.readFileSync(path, 'utf8');\nif (!content.trim()) throw new Error(`Content file ${path} is empty`);\nawait writeNote({ title, content });","handlingStrategy":"validation","validationCode":"const content = String(rawContent ?? '');\nif (!content) throw new Error('--content is required (pass text via --content or stdin)');","typeGuard":"const hasContent = (v) => typeof v === 'string' && v.length > 0;","tryCatchPattern":"try {\n  await writeNote({ title, content });\n} catch (e) {\n  if (String(e.message).includes('--content is required')) {\n    console.error('Usage: write-note --title \"T\" --content \"text\" (or pipe content via stdin).');\n    process.exit(2);\n  }\n  throw e;\n}","preventionTips":["Verify source files/pipes are non-empty before feeding --content.","Set pipefail so empty upstream pipeline output is caught.","Assert content.length > 0 in wrapper scripts.","Check file paths and shell variable expansion for typos."],"tags":["argument-validation","cli","missing-argument","notebooklm"],"backgroundTag":"missing-required-argument","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}