{"record":{"id":"e91b7a302df1c1e6","repo":"jackwener/OpenCLI","slug":"channel-required-e91b7a","errorCode":null,"errorMessage":"channel required","messagePattern":"channel required","errorType":"validation","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"clis/slock/channel-mark.js","lineNumber":30,"sourceCode":"cli({\n  site: SLOCK_SITE,\n  name: 'channel-mark',\n  access: 'write',\n  description: 'Mark a channel read (default), read up to --seq, or --unread.',\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 or #name' },\n    { name: 'seq', type: 'int', help: 'Mark read up to this seq (omit for read-all)' },\n    { name: 'unread', type: 'bool', default: false, help: 'Mark the channel unread instead of read' },\n    { name: 'server', help: 'Override active server' },\n  ],\n  columns: ['channel', 'action', 'result'],\n  func: async (page, kwargs) => {\n    const channel = String(kwargs.channel ?? '').trim();\n    if (!channel) throw new ArgumentError('channel required');\n    const hasSeq = kwargs.seq !== undefined && kwargs.seq !== null && kwargs.seq !== '';\n    if (kwargs.unread && hasSeq) {\n      throw new ArgumentError('--unread and --seq are mutually exclusive');\n    }\n\n    let pathSuffix;\n    let body;\n    let action;\n    if (kwargs.unread) {\n      pathSuffix = '/unread';\n      action = 'unread';\n    } else if (hasSeq) {\n      const seq = Number(kwargs.seq);\n      if (!Number.isInteger(seq) || seq <= 0) throw new ArgumentError(`--seq must be a positive integer (got \"${kwargs.seq}\")`);\n      pathSuffix = '/read';\n      body = { seq };\n      action = `read-to-${seq}`;\n    } else {","sourceCodeStart":12,"sourceCodeEnd":48,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/slock/channel-mark.js#L12-L48","documentation":"`channel-mark` requires a target channel. The CLI trims the `channel` kwarg and throws ArgumentError('channel required') when it is missing or empty, before deciding the read/unread path suffix.","triggerScenarios":"Calling `slock channel-mark` (to mark read/unread) without `--channel`, or with an empty/whitespace-only value.","commonSituations":"Batch scripts iterating channels where one entry is blank, aliases dropping the flag, or piping a channel list with empty lines.","solutions":["Pass the channel: `slock channel-mark --channel '#ops'` (optionally with --seq or --unread)","Skip empty values in loops before invoking the command","Check `slock channel-mark --help` for correct syntax"],"exampleFix":"// before\n$ slock channel-mark --seq 42\nError: channel required\n// after\n$ slock channel-mark --channel '#ops' --seq 42","handlingStrategy":"validation","validationCode":"const channel = String(input.channel ?? '').trim();\nif (!channel) throw new Error('channel must be provided (#name or channelId UUID)');","typeGuard":"const hasChannel = (v) => typeof v === 'string' && v.trim().length > 0;","tryCatchPattern":"try {\n  await run(['slock', 'channel-mark', '--channel', channel, ...extra]);\n} catch (e) {\n  if (e instanceof ArgumentError && e.message === 'channel required') {\n    console.error('Pass --channel <#name|uuid>; the value was empty.');\n  } else throw e;\n}","preventionTips":["Filter blank lines when piping channel lists into channel-mark","Assert required args in wrapper scripts","Quote #names to avoid shell comment stripping"],"tags":["argument-error","cli","validation","missing-argument"],"backgroundTag":"missing-required-argument","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}