jackwener/OpenCLI · error · ArgumentError
status "${status}" not in {${TASK_STATUSES.join('|')}}
Error message
status "${status}" not in {${TASK_STATUSES.join('|')}} What it means
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.
Source
Thrown at clis/slock/task-list-server.js:34
cli({
site: SLOCK_SITE,
name: 'task-list-server',
access: 'read',
description: 'List tasks across all channels in the active server (GET /tasks/server). Optional --status filter.',
domain: SLOCK_DOMAIN,
strategy: Strategy.COOKIE,
browser: true,
siteSession: 'persistent',
args: [
{ name: 'status', help: `Filter by status: ${TASK_STATUSES.join('|')}` },
{ name: 'server', help: 'Override active server' },
],
columns: ['id', 'taskNumber', 'title', 'taskStatus', 'channelId', 'assigneeId'],
func: async (page, kwargs) => {
const status = kwargs.status ? String(kwargs.status).trim() : '';
if (status && !TASK_STATUSES.includes(status)) {
throw new ArgumentError(`status "${status}" not in {${TASK_STATUSES.join('|')}}`);
}
await page.goto(SLOCK_HOME_URL);
const snippet = `
${authHeadersFragment({ serverScoped: true, serverIdOverride: kwargs.server })}
const status = ${JSON.stringify(status)};
const qs = status ? ('?status=' + encodeURIComponent(status)) : '';
const res = await fetch('${SLOCK_API_BASE}/tasks/server' + qs, { credentials:'include', headers });
if (!res.ok) return { kind: res.status===401?'auth':'http', status: res.status, where: '/tasks/server' };
const data = await res.json();
if (!data || !Array.isArray(data.tasks)) {
return { kind: 'http', status: 200, where: '/tasks/server (expected {tasks:[]}, got drift)' };
}
return { kind: 'ok', rows: data.tasks };
`;
const result = await page.evaluate(`(async () => { ${snippet} })()`);
const rows = dispatchEvaluateResult(result);
if (!Array.isArray(rows)) {
throw new CommandExecutionError(`expected array of rows from server, got ${typeof rows} (contract drift?)`);View on GitHub (pinned to 49907e53dc)
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
Example fix
// before
await cli('slock', 'task-list-server', '--status', 'In-Progress');
// after
await cli('slock', 'task-list-server', '--status', 'in_progress'); // exact TASK_STATUSES member Defensive patterns
Strategy: validation
Validate before calling
import { TASK_STATUSES } from 'clis/slock/task-statuses.js';
const status = process.argv[/* --status value */];
if (status && !TASK_STATUSES.includes(status.trim())) {
throw new Error(`status must be one of: ${TASK_STATUSES.join('|')}`);
} Type guard
const isValidStatus = (s) => TASK_STATUSES.includes(String(s ?? '').trim());
Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.
Related errors
- status "${status}" not in {${TASK_STATUSES.join('|')}}
- archive snapshots url cannot be empty
- archive snapshots limit must be a positive integer
- archive snapshots limit must be <= 1000
- archive snapshots ${key} must be a digit-only timestamp (YYY
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/51277ea354f554d2.
Report an issue: GitHub.