{"record":{"id":"16dff1482900d0d7","repo":"jackwener/OpenCLI","slug":"length-must-be-a-positive-integer","errorCode":null,"errorMessage":"--length must be a positive integer","messagePattern":"--length must be a positive integer","errorType":"validation","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"clis/notebooklm/generate-slides.js","lineNumber":52,"sourceCode":"\nexport function parseSlidesIdFromResult(result, excludedIds = []) {\n    const excluded = toExcludedUuidSet(excludedIds);\n    if (typeof result === 'string' && ARTIFACT_UUID_RE.test(result) && !excluded.has(result.toLowerCase())) return result;\n    const stack = [result];\n    while (stack.length) {\n        const node = stack.shift();\n        if (typeof node === 'string' && ARTIFACT_UUID_RE.test(node) && !excluded.has(node.toLowerCase())) return node;\n        if (Array.isArray(node)) for (const child of node) stack.push(child);\n        else if (node && typeof node === 'object') for (const v of Object.values(node)) stack.push(v);\n    }\n    return '';\n}\n\nexport function parseSlideDeckLength(value) {\n    if (value === undefined || value === '') return 3;\n    const length = Number(value);\n    if (!Number.isInteger(length) || length <= 0) {\n        throw new ArgumentError('--length must be a positive integer');\n    }\n    return length;\n}\n\ncli({\n    site: NOTEBOOKLM_SITE,\n    name: 'generate-slides',\n    access: 'write',\n    description: 'Trigger a Slide Deck (AI presentation) generation for a NotebookLM notebook, using all of its sources',\n    domain: NOTEBOOKLM_DOMAIN,\n    strategy: Strategy.COOKIE,\n    browser: true,\n    navigateBefore: false,\n    args: [\n        { name: 'notebook', positional: true, required: true, help: 'Notebook id from `notebooklm list` or full notebook URL' },\n        { name: 'length', help: 'Slide deck length: 1=Short, 3=Default (default 3)' },\n        { name: 'language', help: 'Language code (default en)' },\n        { name: 'execute', type: 'boolean', help: 'Actually trigger remote NotebookLM slide deck generation' },","sourceCodeStart":34,"sourceCodeEnd":70,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/notebooklm/generate-slides.js#L34-L70","documentation":"This ArgumentError comes from `parseSlideDeckLength` and validates the `--length` option of `notebooklm generate-slides`. The value must be a positive integer (or empty/undefined, which defaults to 3); anything else — non-numeric strings, decimals, zero, or negatives — throws.","triggerScenarios":"Passing `--length 0`, `--length -1`, `--length 2.5`, `--length \"three\"`, or `--length \"\"`-adjacent garbage like `--length abc` to generate-slides.","commonSituations":"Copy-pasted flags with units ('10 slides'), locale decimal commas ('2,5'), or shell quoting issues splitting the value.","solutions":["Pass a positive integer, e.g. `--length 5`.","Omit `--length` entirely to use the default of 3.","Quote the value if your shell mangles it: `--length=\"5\"`."],"exampleFix":"// before\nopencli notebooklm generate-slides --notebook id --length 2.5\n// after\nopencli notebooklm generate-slides --notebook id --length 5","handlingStrategy":"validation","validationCode":"function validateLength(value) {\n  if (value === undefined || value === '') return 3;\n  const n = Number(value);\n  if (!Number.isInteger(n) || n <= 0) throw new Error(`--length must be a positive integer, got ${JSON.stringify(value)}`);\n  return n;\n}","typeGuard":"const isPositiveInt = (v) => Number.isInteger(Number(v)) && Number(v) > 0;","tryCatchPattern":"try {\n  await generateSlides({ notebookId, length });\n} catch (e) {\n  if (String(e.message).includes('--length must be a positive integer')) {\n    throw new Error(`Bad --length value: ${JSON.stringify(length)}; use a positive integer or omit for default 3`);\n  }\n  throw e;\n}","preventionTips":["Always pass --length as a bare positive integer (no units, no decimals).","Omit --length to use the default of 3.","Validate CLI args in wrappers/scripts before invoking opencli."],"tags":["argument-validation","cli","input-validation","notebooklm"],"backgroundTag":"invalid-argument-value","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}