{"record":{"id":"972123784af50e39","repo":"nanocoai/nanoclaw","slug":"group-is-required-972123","errorCode":null,"errorMessage":"--group is required","messagePattern":"--group is required","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/cli/resources/tasks.ts","lineNumber":143,"sourceCode":"}\n\nfunction selectLiveTasks(mailbox: InboundMailbox, status?: TaskStatus): TaskRow[] {\n  return mailbox.listLiveTasks(status);\n}\n\nfunction selectTask(mailbox: InboundMailbox, id: string): TaskRow | undefined {\n  return mailbox.getTask(id);\n}\n\nfunction taskId(args: Record<string, unknown>): string {\n  const id = str(args.id);\n  if (!id) throw new Error('task series id is required');\n  return id;\n}\n\nasync function createTask(args: Record<string, unknown>, ctx: CallerContext) {\n  const group = groupArg(args, ctx);\n  if (!group) throw new Error('--group is required');\n  const prompt = str(args.prompt);\n  if (!prompt) throw new Error('--prompt is required');\n  const recurrence = normalizeNullableString(args.recurrence) ?? null;\n  const script = normalizeNullableString(args.script) ?? null;\n  const prepared = prepareScheduledTask({\n    name: str(args.name),\n    prompt,\n    recurrence,\n    processAfter: str(args.process_after),\n    script,\n    dangerouslyOverrideRecurrenceLimit: bool(args.dangerously_override_recurrence_limit),\n    timezone: await resolveGroupTimezone(group),\n  });\n  const { session, row } = await createScheduledTask(group, prepared, {\n    originSessionId: ctx.caller === 'agent' ? ctx.sessionId : null,\n  });\n  return toOutput(session, row);\n}","sourceCodeStart":125,"sourceCodeEnd":161,"githubUrl":"https://github.com/nanocoai/nanoclaw/blob/294ef2aee85218b23ad30eda9dfe10e590b54a8c/src/cli/resources/tasks.ts#L125-L161","documentation":"Thrown by `createTask` when no agent group can be resolved for the new task. The group comes from `groupArg`: for agent callers it is the auto-filled ctx.agentGroupId; for operator/host callers it must be supplied as `--group` (or `--agent_group_id`). Every task series belongs to exactly one agent group, so creation cannot proceed without one.","triggerScenarios":"An operator runs `ncl tasks create --prompt ...` without `--group`; an agent-runner path where ctx.agentGroupId is somehow unset; passing the group positionally or under a different flag name so both args.group and args.agent_group_id are empty.","commonSituations":"Operators forgetting --group because the wizard/UI normally fills it in; copying a create command from agent context (where the flag is auto-filled) into host context; referencing a group by folder name instead of its id.","solutions":["Add `--group <agent-group-id>` (find it with `ncl groups list`)","Alternatively use the accepted alias `--agent_group_id <id>`","When automating, resolve the group id once via `ncl groups list --json` and inject it"],"exampleFix":"# before\nncl tasks create --prompt \"daily report\" --name daily\n# after\nncl tasks create --group grp_123 --prompt \"daily report\" --name daily","handlingStrategy":"validation","validationCode":"const groups = await execNclJson(['groups', 'list']);\nconst group = groups.find(g => g.id === groupId || g.folder === groupId);\nif (!group) throw new Error(`unknown agent group ${groupId}`);\nawait execNcl(['tasks', 'create', '--group', group.id, '--prompt', prompt]);","typeGuard":"const hasGroup = (g: unknown): g is string => typeof g === 'string' && g.trim().length > 0;","tryCatchPattern":null,"preventionTips":["Operator-side scripts must always pass --group; only agent callers get it auto-filled","Cache the resolved group id — don't guess folder names","Fail fast if the group variable is empty before invoking ncl"],"tags":["cli","tasks","validation","agent-group"],"backgroundTag":"missing-required-parameter","analyzedSha":"294ef2aee85218b23ad30eda9dfe10e590b54a8c","analyzedAt":"2026-08-28T13:59:10.357Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}