{"record":{"id":"a4f6234f09a1b71a","repo":"jackwener/OpenCLI","slug":"channel-required-a4f623","errorCode":null,"errorMessage":"channel required","messagePattern":"channel required","errorType":"validation","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"clis/slock/task-list.js","lineNumber":37,"sourceCode":"\ncli({\n  site: SLOCK_SITE,\n  name: 'task-list',\n  access: 'read',\n  description: 'List tasks (chat tasks = messages with task fields) attached to a channel. Optional --status filter.',\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: 'status', help: `Filter by status: ${TASK_STATUSES.join('|')}` },\n    { name: 'server', help: 'Override active server' },\n  ],\n  columns: ['id', 'taskNumber', 'title', 'taskStatus', 'assigneeId'],\n  func: async (page, kwargs) => {\n    const channel = String(kwargs.channel ?? '').trim();\n    if (!channel) throw new ArgumentError('channel required');\n    const status = kwargs.status ? String(kwargs.status).trim() : '';\n    if (status && !TASK_STATUSES.includes(status)) {\n      throw new ArgumentError(`status \"${status}\" not in {${TASK_STATUSES.join('|')}}`);\n    }\n    await page.goto(SLOCK_HOME_URL);\n    const snippet = `\n      ${authHeadersFragment({ serverScoped: true, serverIdOverride: kwargs.server })}\n      ${channelResolveFragment(channel)}\n      const status = ${JSON.stringify(status)};\n      const qs = status ? ('?status=' + encodeURIComponent(status)) : '';\n      const tres = await fetch('${SLOCK_API_BASE}/tasks/channel/' + encodeURIComponent(channelId) + qs, { credentials:'include', headers });\n      if (!tres.ok) return { kind: tres.status===401?'auth':'http', status: tres.status, where: '/tasks/channel/:id' };\n      const data = await tres.json();\n      // Server contract: { tasks: [...] }. Reject anything else as drift.\n      if (!data || !Array.isArray(data.tasks)) {\n        return { kind: 'http', status: 200, where: '/tasks/channel/:id (expected {tasks:[]}, got drift)' };\n      }\n      return { kind: 'ok', rows: data.tasks };","sourceCodeStart":19,"sourceCodeEnd":55,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/slock/task-list.js#L19-L55","documentation":"The slock task-list command requires a --channel argument: it trims kwargs.channel and throws an ArgumentError if the result is empty. Since tasks are always fetched per-channel via the API, listing without a channel is unsupported and rejected before any navigation or fetch.","triggerScenarios":"Running `slock task-list` without --channel, or with --channel '' / only whitespace, or with a variable that was never set so kwargs.channel is undefined.","commonSituations":"Forgetting the required flag in scripts; shell variable empty due to unset env/config; confusing channel name with channel id and passing an empty override; copy-pasting a command line and dropping the flag.","solutions":["Add the required flag: slock task-list --channel <channel-name>","If the channel comes from a variable, verify it is non-empty before invoking","Use slock task-list-server (no channel required) if you want server-wide listing","Check --help for the exact flag name (--channel) in case of typos like --chan"],"exampleFix":"// before\nawait cli('slock', 'task-list'); // missing channel\n// after\nawait cli('slock', 'task-list', '--channel', 'general');","handlingStrategy":"validation","validationCode":"const channel = String(process.env.CHANNEL ?? '').trim();\nif (!channel) {\n  throw new Error('CHANNEL must be set: slock task-list --channel <name>');\n}","typeGuard":"const hasChannel = (kwargs) => typeof kwargs?.channel === 'string' && kwargs.channel.trim().length > 0;","tryCatchPattern":null,"preventionTips":["Always supply --channel when listing tasks; use task-list-server for server-wide lists","Check that interpolated shell variables are non-empty","Add a wrapper that errors early with usage text when --channel is absent"],"tags":["missing-argument","cli-input","argument-validation"],"backgroundTag":"missing-required-argument","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}