{"record":{"id":"29f9001a80e3e96c","repo":"nanocoai/nanoclaw","slug":"prompt-is-required","errorCode":null,"errorMessage":"--prompt is required","messagePattern":"--prompt is required","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/cli/resources/tasks.ts","lineNumber":145,"sourceCode":"function 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}\n\n/**","sourceCodeStart":127,"sourceCodeEnd":163,"githubUrl":"https://github.com/nanocoai/nanoclaw/blob/294ef2aee85218b23ad30eda9dfe10e590b54a8c/src/cli/resources/tasks.ts#L127-L163","documentation":"Thrown by `createTask` when a group was resolved but `--prompt` is empty. A task series is driven by either a prompt or a script; this code path (the prompt-based one) requires a non-empty prompt string, which is what the agent executes on each run/recurrence.","triggerScenarios":"Running `ncl tasks create --group g --name x` with no --prompt (and no script path); passing `--prompt ''` or an unset shell variable; whitespace/quote mistakes that leave args.prompt empty.","commonSituations":"Shell scripts where $PROMPT is empty due to a missing export; intending a script-based task but forgetting --script (prompt and script are the two mutually exclusive drivers — omitting both hits this error if prompt is checked first); prompt passed after a `--` separator or inside the wrong quotes.","solutions":["Add the prompt: `ncl tasks create --group g --prompt \"...\" --name x`","For script tasks, pass `--script <path>` instead of --prompt","In scripts, guard: `[ -n \"$PROMPT\" ] || { echo 'prompt missing'; exit 1; }`"],"exampleFix":"# before\nncl tasks create --group grp_123 --name daily-report\n# after\nncl tasks create --group grp_123 --name daily-report --prompt \"Summarize yesterday's logs\"","handlingStrategy":"validation","validationCode":"const prompt = String(process.env.TASK_PROMPT ?? '').trim();\nif (!prompt) throw new Error('tasks create needs a non-empty --prompt (or --script)');\nawait execNcl(['tasks', 'create', '--group', group, '--prompt', prompt]);","typeGuard":"const isNonEmptyPrompt = (p: unknown): p is string =>\n  typeof p === 'string' && p.trim().length > 0;","tryCatchPattern":null,"preventionTips":["Guard empty env vars before building the ncl command","Choose one driver: --prompt or --script, and assert exactly one is set","Quote prompts properly to avoid shell word-splitting dropping the value"],"tags":["cli","tasks","validation","prompt"],"backgroundTag":"missing-required-parameter","analyzedSha":"294ef2aee85218b23ad30eda9dfe10e590b54a8c","analyzedAt":"2026-08-28T13:59:10.357Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}