{"record":{"id":"51277ea354f554d2","repo":"jackwener/OpenCLI","slug":"status-status-not-in-task-statuses-join","errorCode":null,"errorMessage":"status \"${status}\" not in {${TASK_STATUSES.join('|')}}","messagePattern":"status \"(.+?)\" not in (.+?)","errorType":"validation","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"clis/slock/task-list-server.js","lineNumber":34,"sourceCode":"\ncli({\n  site: SLOCK_SITE,\n  name: 'task-list-server',\n  access: 'read',\n  description: 'List tasks across all channels in the active server (GET /tasks/server). Optional --status filter.',\n  domain: SLOCK_DOMAIN,\n  strategy: Strategy.COOKIE,\n  browser: true,\n  siteSession: 'persistent',\n  args: [\n    { name: 'status', help: `Filter by status: ${TASK_STATUSES.join('|')}` },\n    { name: 'server', help: 'Override active server' },\n  ],\n  columns: ['id', 'taskNumber', 'title', 'taskStatus', 'channelId', 'assigneeId'],\n  func: async (page, kwargs) => {\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      const status = ${JSON.stringify(status)};\n      const qs = status ? ('?status=' + encodeURIComponent(status)) : '';\n      const res = await fetch('${SLOCK_API_BASE}/tasks/server' + qs, { credentials:'include', headers });\n      if (!res.ok) return { kind: res.status===401?'auth':'http', status: res.status, where: '/tasks/server' };\n      const data = await res.json();\n      if (!data || !Array.isArray(data.tasks)) {\n        return { kind: 'http', status: 200, where: '/tasks/server (expected {tasks:[]}, got drift)' };\n      }\n      return { kind: 'ok', rows: data.tasks };\n    `;\n    const result = await page.evaluate(`(async () => { ${snippet} })()`);\n    const rows = dispatchEvaluateResult(result);\n    if (!Array.isArray(rows)) {\n      throw new CommandExecutionError(`expected array of rows from server, got ${typeof rows} (contract drift?)`);","sourceCodeStart":16,"sourceCodeEnd":52,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/slock/task-list-server.js#L16-L52","documentation":"The slock task-list-server command validates the optional --status flag against the fixed TASK_STATUSES set before doing any work. An unknown status value throws an ArgumentError listing the allowed values. This rejects invalid filters locally instead of sending a request that would fail with a 400.","triggerScenarios":"Running `slock task-list-server --status <value>` where value (trimmed) is not one of the entries in TASK_STATUSES — e.g. wrong casing ('Open' vs 'open'), synonyms ('in-progress' vs the canonical token), or typos.","commonSituations":"Guessing status names without checking the help text; copying filter values from another tracker (Jira/GitHub) with different vocabularies; script variables containing empty-plus-junk strings; casing drift after a refactor.","solutions":["Run `slock task-list-server --help` to see the exact allowed status values and pass one of them","Match casing exactly (statuses are compared case-sensitively after trim)","Omit --status entirely to list all tasks, then filter client-side","If you control the caller script, validate the value against TASK_STATUSES before invoking"],"exampleFix":"// before\nawait cli('slock', 'task-list-server', '--status', 'In-Progress');\n// after\nawait cli('slock', 'task-list-server', '--status', 'in_progress'); // exact TASK_STATUSES member","handlingStrategy":"validation","validationCode":"import { TASK_STATUSES } from 'clis/slock/task-statuses.js';\nconst status = process.argv[/* --status value */];\nif (status && !TASK_STATUSES.includes(status.trim())) {\n  throw new Error(`status must be one of: ${TASK_STATUSES.join('|')}`);\n}","typeGuard":"const isValidStatus = (s) => TASK_STATUSES.includes(String(s ?? '').trim());","tryCatchPattern":null,"preventionTips":["Consult --help for the exact status vocabulary before scripting","Normalize case/underscores to the canonical tokens","Reuse the TASK_STATUSES constant in callers instead of hardcoding strings"],"tags":["argument-validation","enum-validation","cli-input"],"backgroundTag":"invalid-enum-value","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}