nanocoai/nanoclaw · error · Error
--prompt is required
Error message
--prompt is required
What it means
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.
Source
Thrown at src/cli/resources/tasks.ts:145
function selectLiveTasks(mailbox: InboundMailbox, status?: TaskStatus): TaskRow[] {
return mailbox.listLiveTasks(status);
}
function selectTask(mailbox: InboundMailbox, id: string): TaskRow | undefined {
return mailbox.getTask(id);
}
function taskId(args: Record<string, unknown>): string {
const id = str(args.id);
if (!id) throw new Error('task series id is required');
return id;
}
async function createTask(args: Record<string, unknown>, ctx: CallerContext) {
const group = groupArg(args, ctx);
if (!group) throw new Error('--group is required');
const prompt = str(args.prompt);
if (!prompt) throw new Error('--prompt is required');
const recurrence = normalizeNullableString(args.recurrence) ?? null;
const script = normalizeNullableString(args.script) ?? null;
const prepared = prepareScheduledTask({
name: str(args.name),
prompt,
recurrence,
processAfter: str(args.process_after),
script,
dangerouslyOverrideRecurrenceLimit: bool(args.dangerously_override_recurrence_limit),
timezone: await resolveGroupTimezone(group),
});
const { session, row } = await createScheduledTask(group, prepared, {
originSessionId: ctx.caller === 'agent' ? ctx.sessionId : null,
});
return toOutput(session, row);
}
/**View on GitHub (pinned to 294ef2aee8)
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; }`
Example fix
# before ncl tasks create --group grp_123 --name daily-report # after ncl tasks create --group grp_123 --name daily-report --prompt "Summarize yesterday's logs"
Defensive patterns
Strategy: validation
Validate before calling
const prompt = String(process.env.TASK_PROMPT ?? '').trim();
if (!prompt) throw new Error('tasks create needs a non-empty --prompt (or --script)');
await execNcl(['tasks', 'create', '--group', group, '--prompt', prompt]); Type guard
const isNonEmptyPrompt = (p: unknown): p is string => typeof p === 'string' && p.trim().length > 0;
Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: Missing required parameter errors: what 'X is required' and 'the required X param is missing' mean, and how to fix them — this error's family across 27 libraries.
Related errors
- --status must be pending or paused
- task series id is required
- --group is required
- --${column.name.replace(/_/g, '-')} must be true or false
- ${col.name} must be one of: ${col.enum.join(', ')}
AI-assisted analysis of nanocoai/nanoclaw@294ef2aee8 (2026-08-28).
Data as JSON: /api/errors/29f9001a80e3e96c.
Report an issue: GitHub.