{"record":{"id":"69e45cf25ff65b80","repo":"jackwener/OpenCLI","slug":"argument-content-is-required","errorCode":null,"errorMessage":"Argument \"content\" is required.","messagePattern":"Argument \"content\" is required\\.","errorType":"validation","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"clis/instagram/note.js","lineNumber":14,"sourceCode":"import { ArgumentError, CommandExecutionError } from '@jackwener/opencli/errors';\nimport { cli, Strategy } from '@jackwener/opencli/registry';\nconst INSTAGRAM_INBOX_URL = 'https://www.instagram.com/direct/inbox/';\nconst INSTAGRAM_NOTE_DOC_ID = '25155183657506484';\nconst INSTAGRAM_NOTE_MUTATION_NAME = 'usePolarisCreateInboxTrayItemSubmitMutation';\nconst INSTAGRAM_NOTE_ROOT_FIELD = 'xdt_create_inbox_tray_item';\nfunction requirePage(page) {\n    if (!page)\n        throw new CommandExecutionError('Browser session required for instagram note');\n    return page;\n}\nfunction validateInstagramNoteArgs(kwargs) {\n    if (kwargs.content === undefined) {\n        throw new ArgumentError('Argument \"content\" is required.', 'Provide a note text, for example: opencli instagram note \"hello\"');\n    }\n}\nfunction normalizeInstagramNoteContent(kwargs) {\n    const content = String(kwargs.content ?? '').trim();\n    if (!content) {\n        throw new ArgumentError('Instagram note content cannot be empty.', 'Provide a non-empty note text, for example: opencli instagram note \"hello\"');\n    }\n    if (Array.from(content).length > 60) {\n        throw new ArgumentError('Instagram note content must be 60 characters or fewer.', 'Shorten the note text and try again.');\n    }\n    return content;\n}\nfunction buildNoteSuccessResult(noteId) {\n    return [{\n            status: '✅ Posted',\n            detail: 'Instagram note published successfully',\n            noteId,\n        }];","sourceCodeStart":1,"sourceCodeEnd":32,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/instagram/note.js#L1-L32","documentation":"validateInstagramNoteArgs enforces that the kwargs passed to instagram note include content. When kwargs.content === undefined the ArgumentError is thrown with a usage hint. This is an input-contract check performed before any browser or network work.","triggerScenarios":"Invoking the note command with no positional text (e.g. 'opencli instagram note') or programmatically calling with kwargs lacking the content key.","commonSituations":"Copy-pasting the command but omitting the quoted note text; shell quoting swallowing an empty string argument; building kwargs dynamically and forgetting the content field; CLI arg parser dropping empty strings.","solutions":["Pass the note text as an argument: opencli instagram note \"hello\"","Quote the content so shells keep empty/whitespace values intact","In programmatic use, set kwargs.content before calling","Check your arg-parser setup isn't discarding empty-string arguments"],"exampleFix":"// before\nconst kwargs = {}; // content missing\nawait instagramNote(ctx, kwargs);\n// after\nconst kwargs = { content: 'hello world' };\nawait instagramNote(ctx, kwargs);","handlingStrategy":"validation","validationCode":"if (typeof kwargs.content !== 'string') {\n  throw new TypeError('content is required: opencli instagram note \"hello\"');\n}","typeGuard":"function hasContent(kwargs) {\n  return kwargs != null && typeof kwargs.content === 'string';\n}","tryCatchPattern":"try {\n  await instagramNote(ctx, kwargs);\n} catch (e) {\n  if (e.message.includes('content\" is required')) {\n    console.error('Usage: opencli instagram note \"<text>\"');\n  } else throw e;\n}","preventionTips":["Quote note text in shell invocations","Validate argv length before invoking the command","Check arg-parser config doesn't drop empty strings","In scripts, assert kwargs.content exists before the call"],"tags":["argument-validation","cli","input"],"backgroundTag":"missing-required-argument","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}