{"record":{"id":"760274fe5f9dbe0c","repo":"jackwener/OpenCLI","slug":"unread-and-seq-are-mutually-exclusive","errorCode":null,"errorMessage":"--unread and --seq are mutually exclusive","messagePattern":"--unread and --seq are mutually exclusive","errorType":"validation","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"clis/slock/channel-mark.js","lineNumber":33,"sourceCode":"  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 {\n      pathSuffix = '/read-all';\n      action = 'read-all';\n    }","sourceCodeStart":15,"sourceCodeEnd":51,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/slock/channel-mark.js#L15-L51","documentation":"`channel-mark` treats `--unread` (mark whole channel unread) and `--seq` (mark read up to a sequence number) as mutually exclusive modes. Passing both is ambiguous, so the CLI throws ArgumentError before issuing any request.","triggerScenarios":"Running e.g. `slock channel-mark --channel '#ops' --unread --seq 42` — i.e. `unread` is true and `seq` is a non-empty value (not undefined/null/'').","commonSituations":"Wrapper scripts that always append --seq while also forwarding --unread from a flag, or users combining examples from docs of different modes.","solutions":["Use only one mode: either `--unread` or `--seq <n>` (or neither for read-all)","Split the intent into two invocations if both operations are wanted","Fix wrapper scripts to emit the flags conditionally"],"exampleFix":"// before\n$ slock channel-mark --channel '#ops' --unread --seq 42\nError: --unread and --seq are mutually exclusive\n// after\n$ slock channel-mark --channel '#ops' --unread\n$ slock channel-mark --channel '#ops' --seq 42","handlingStrategy":"validation","validationCode":"const flags = [];\nif (wantUnread) flags.push('--unread');\nelse if (seq != null && seq !== '') flags.push('--seq', String(seq));\nif (wantUnread && seq != null && seq !== '') throw new Error('choose either --unread or --seq, not both');","typeGuard":null,"tryCatchPattern":"try {\n  await run(['slock', 'channel-mark', '--channel', channel, ...flags]);\n} catch (e) {\n  if (e instanceof ArgumentError && /mutually exclusive/.test(e.message)) {\n    console.error('Pick one mode: --unread OR --seq <n> OR neither (read-all).');\n  } else throw e;\n}","preventionTips":["Build flag arrays conditionally instead of always appending both","Split read and unread operations into separate invocations","Document mode selection in wrapper scripts"],"tags":["argument-error","cli","conflicting-options","validation"],"backgroundTag":"mutually-exclusive-options","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}