{"record":{"id":"b0f80fda898cbc9e","repo":"nanocoai/nanoclaw","slug":"status-must-be-pending-or-paused","errorCode":null,"errorMessage":"--status must be pending or paused","messagePattern":"--status must be pending or paused","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/cli/resources/tasks.ts","lineNumber":65,"sourceCode":"\nfunction bool(value: unknown): boolean {\n  return value === true || value === 'true' || value === '1';\n}\n\nfunction normalizeNullableString(value: unknown): string | null | undefined {\n  if (value === undefined) return undefined;\n  if (value === null) return null;\n  if (typeof value !== 'string') return String(value);\n  const trimmed = value.trim();\n  if (trimmed === '' || trimmed === 'null' || trimmed === 'none') return null;\n  return value;\n}\n\nfunction statusFilter(args: Record<string, unknown>): TaskStatus | undefined {\n  const status = str(args.status);\n  if (!status) return undefined;\n  if (status !== 'pending' && status !== 'paused') {\n    throw new Error('--status must be pending or paused');\n  }\n  return status;\n}\n\nfunction groupArg(args: Record<string, unknown>, ctx: CallerContext): string | undefined {\n  if (ctx.caller === 'agent') return ctx.agentGroupId;\n  return str(args.group) ?? str(args.agent_group_id);\n}\n\nasync function ownSession(sessionId: string, ctx: CallerContext): Promise<ScopedSession> {\n  const session = await getSession(sessionId);\n  if (!session) throw new Error(`session not found: ${sessionId}`);\n  if (ctx.caller === 'agent' && session.agent_group_id !== ctx.agentGroupId) {\n    throw new Error(`session not found: ${sessionId}`);\n  }\n  return { id: session.id, agent_group_id: session.agent_group_id };\n}\n","sourceCodeStart":47,"sourceCodeEnd":83,"githubUrl":"https://github.com/nanocoai/nanoclaw/blob/294ef2aee85218b23ad30eda9dfe10e590b54a8c/src/cli/resources/tasks.ts#L47-L83","documentation":"Thrown by `statusFilter` in the tasks resource when `ncl tasks list --status <value>` is given anything other than `pending` or `paused`. Those are the only two statuses that make sense to filter a listing by (active/dormant states); terminal or runtime states like `running`, `done`, or `cancelled` are not accepted list filters.","triggerScenarios":"Running `ncl tasks list --status running`, `--status done`, `--status active`, or any arbitrary string. The filter runs early in the list handler, before any DB query.","commonSituations":"Assuming the filter accepts the full task status enum (create/cancel/update use more statuses than list accepts); copying a status from `ncl tasks get` output into a list filter; scripts written against an older or assumed API surface.","solutions":["Use `--status pending` or `--status paused` — the only accepted filters","Omit --status entirely to list tasks regardless of status, then filter client-side or via --json","Check `ncl tasks help` for the current flag contract"],"exampleFix":"# before\nncl tasks list --status running\n# after\nncl tasks list --status pending","handlingStrategy":"validation","validationCode":"const TASK_LIST_STATUSES = ['pending', 'paused'] as const;\nconst s = status satisfies string | undefined;\nif (s && !TASK_LIST_STATUSES.includes(s as any)) {\n  throw new Error(`--status must be one of ${TASK_LIST_STATUSES.join('|')}`);\n}","typeGuard":"const isListFilterableStatus = (s: unknown): s is 'pending' | 'paused' =>\n  s === 'pending' || s === 'paused';","tryCatchPattern":null,"preventionTips":["Pin the accepted filter set in a constant shared by scripts","Read `ncl tasks help` after upgrades — flag contracts can tighten","When unsure, omit --status and filter the --json output yourself"],"tags":["cli","tasks","validation","status-filter"],"backgroundTag":"invalid-enum-value","analyzedSha":"294ef2aee85218b23ad30eda9dfe10e590b54a8c","analyzedAt":"2026-08-28T13:59:10.357Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}