{"record":{"id":"8e4593e9408de8ae","repo":"jackwener/OpenCLI","slug":"seq-must-be-a-positive-integer-got-kwargs-se","errorCode":null,"errorMessage":"--seq must be a positive integer (got \"${kwargs.seq}\")","messagePattern":"--seq must be a positive integer \\(got \"(.+?)\"\\)","errorType":"validation","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"clis/slock/channel-mark.js","lineNumber":44,"sourceCode":"  ],\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    }\n\n    await page.goto(SLOCK_HOME_URL);\n    const snippet = buildChannelScopedSnippet({\n      channelInput: channel,\n      method: 'POST',\n      pathSuffix,\n      body,\n      serverIdOverride: kwargs.server,\n    });\n    const result = await page.evaluate(`(async () => { ${snippet} })()`);\n    const data = dispatchEvaluateResult(result);","sourceCodeStart":26,"sourceCodeEnd":62,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/slock/channel-mark.js#L26-L62","documentation":"When `--seq` is provided to `channel-mark`, the CLI converts it with `Number()` and requires a positive integer (used as the read-up-to sequence number in the request body). Non-integer, zero, negative, or non-numeric values throw ArgumentError including the original input.","triggerScenarios":"`--seq 0`, `--seq -5`, `--seq 12.5`, `--seq abc`, or a quoted/whitespace value like `--seq \" 42 \"` that Number() coerces to NaN.","commonSituations":"Passing a timestamp or message id instead of a sequence number, shell quoting artifacts, or scripts feeding float values from JSON.","solutions":["Pass a positive integer: `slock channel-mark --channel '#ops' --seq 42`","Coerce/validate in scripts: `--seq \"${SEQ%%.*}\"` after checking `${SEQ%%.*}\" = \"$SEQ` for integers","Omit --seq to use the default read-all behavior","Confirm the correct value from `channel-list`/message metadata rather than guessing"],"exampleFix":"// before\n$ slock channel-mark --channel '#ops' --seq 12.5\nError: --seq must be a positive integer (got \"12.5\")\n// after\n$ slock channel-mark --channel '#ops' --seq 13","handlingStrategy":"validation","validationCode":"const raw = String(input.seq ?? '').trim();\nif (raw !== '') {\n  const n = Number(raw);\n  if (!Number.isInteger(n) || n <= 0) throw new Error(`--seq must be a positive integer, got: ${raw}`);\n}","typeGuard":"const isPositiveInt = (v) => Number.isInteger(v) && v > 0;","tryCatchPattern":"try {\n  await run(['slock', 'channel-mark', '--channel', channel, '--seq', raw]);\n} catch (e) {\n  if (e instanceof ArgumentError && /--seq must be a positive integer/.test(e.message)) {\n    console.error('Pass a whole number > 0, or omit --seq for read-all.');\n  } else throw e;\n}","preventionTips":["Pass sequence numbers, not timestamps or message ids","Validate integer-ness in scripts before passing --seq","Quote numeric args to avoid shell/whitespace coercion issues"],"tags":["argument-error","cli","validation","integer-parse"],"backgroundTag":"invalid-argument-type","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}