{"record":{"id":"6975334f94b7954d","repo":"jackwener/OpenCLI","slug":"channel-required-697533","errorCode":null,"errorMessage":"channel required","messagePattern":"channel required","errorType":"validation","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"clis/slock/message-read.js","lineNumber":45,"sourceCode":"  name: 'message-read',\n  access: 'read',\n  description: 'Read messages in a channel or thread. Thread form: \"#channel:msgIdOrShort\". Use --after seq|UUID for cursor.',\n  domain: SLOCK_DOMAIN,\n  strategy: Strategy.COOKIE,\n  browser: true,\n  siteSession: 'persistent',\n  args: [\n    { name: 'channel', positional: true, required: true, help: 'channelId UUID, \"#name\", or \"#channel:msgIdOrShort\"' },\n    { name: 'after', help: 'Cursor: seq number or messageId UUID (exclusive)' },\n    { name: 'before', help: 'seq to page before' },\n    { name: 'limit', type: 'int', default: 50, help: 'Max messages' },\n    { name: 'no-threads', type: 'bool', default: false, help: 'Skip /threads enrichment' },\n    { name: 'server', help: 'Override active server' },\n  ],\n  columns: ['id', 'seq', 'createdAt', 'senderName', 'content', 'threadChannelId', 'replyCount', 'unreadCount', 'lastReplyAt'],\n  func: async (page, kwargs) => {\n    const channel = String(kwargs.channel ?? '').trim();\n    if (!channel) throw new ArgumentError('channel required');\n    const tt = classifyThreadTarget(channel);\n    const isUuid = UUID_RE.test(channel);\n    const after = kwargs.after !== undefined ? String(kwargs.after) : '';\n    if (after && !/^\\d+$/.test(after) && !UUID_RE.test(after)) {\n      throw new ArgumentError(`--after must be a seq number or messageId UUID (got \"${after}\")`);\n    }\n    const limit = parsePositiveInteger(kwargs.limit, '--limit', { defaultValue: 50 });\n    const before = kwargs.before !== undefined ? String(kwargs.before) : '';\n    if (before && !/^\\d+$/.test(before)) {\n      throw new ArgumentError(`--before must be a seq number (got \"${before}\")`);\n    }\n    if (before) parsePositiveInteger(before, '--before');\n    const noThreads = !!kwargs['no-threads'];\n    // R1 — pass the raw override through to authHeadersFragment; it owns the\n    // UUID-vs-slug resolution against /servers/ now.\n    const override = kwargs.server ?? null;\n\n    await page.goto(SLOCK_HOME_URL);","sourceCodeStart":27,"sourceCodeEnd":63,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/slock/message-read.js#L27-L63","documentation":"message-read.js requires a `channel` argument identifying which channel's messages to read. If the kwarg is missing or an empty/whitespace string after trimming, it throws ArgumentError('channel required').","triggerScenarios":"Calling the message-read command without `--channel`, or with `--channel \"\"` / only whitespace.","commonSituations":"Forgetting the flag in a scripted invocation; passing a variable that is undefined/null; copy-pasting a command and dropping the channel argument.","solutions":["Pass the channel: e.g. `--channel #general` or the channel UUID.","Check the value sourcing the flag is defined and non-empty (env var, previous command output).","Run the command's help to confirm the exact flag name."],"exampleFix":"// before\nawait run('message-read', {});\n// after\nawait run('message-read', { channel: '#general' });","handlingStrategy":"validation","validationCode":"if (!kwargs.channel || !String(kwargs.channel).trim()) throw new Error('message-read: --channel is required');","typeGuard":"const channel = typeof kwargs.channel === 'string' && kwargs.channel.trim() ? kwargs.channel.trim() : null;\nif (!channel) throw new Error('channel required');","tryCatchPattern":"try { await readMessages(page, kwargs); } catch (e) { if (e instanceof ArgumentError && e.message === 'channel required') { console.error('Usage: message-read --channel <#slug|uuid>'); } else throw e; }","preventionTips":["Always include --channel in message-read invocations/scripts","Validate kwargs objects before dispatching CLI commands","Keep channel identifiers in a config file and assert non-empty at startup"],"tags":["missing-argument","cli","validation"],"backgroundTag":"missing-required-argument","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}