nanocoai/nanoclaw · error
--prompt is required
Error message
--prompt is required
What it means
prepareScheduledTask requires a non-empty prompt — the textual instruction the scheduled agent will run is mandatory. Without it a task would have nothing to execute, so creation is rejected immediately with '--prompt is required'. This mirrors the CLI flag name of the same option.
Source
Thrown at src/modules/scheduling/create.ts:112
if (fires > MAX_DAILY_FIRES) throw new Error(RECURRENCE_LIMIT_WARNING);
}
/**
* Validate task semantics and derive its first run without writing anything.
* `timezone` grounds wall-clock interpretation (cron grid, naive
* --process-after) — pass the owning group's effective timezone
* (`resolveGroupTimezone`); it defaults to the install-global one.
*/
export function prepareScheduledTask(input: {
name?: string;
prompt: string;
recurrence?: string | null;
processAfter?: string;
script?: string | null;
dangerouslyOverrideRecurrenceLimit?: boolean;
timezone?: string;
}): PreparedScheduledTask {
if (!input.prompt) throw new Error('--prompt is required');
const recurrence = input.recurrence ?? null;
const script = input.script ?? null;
const tz = input.timezone ?? TIMEZONE;
validateRecurrence(recurrence, tz);
enforceRecurrenceLimit(recurrence, input.dangerouslyOverrideRecurrenceLimit === true, script !== null, tz);
let processAfter: string;
if (input.processAfter === undefined && recurrence) {
const next = CronExpressionParser.parse(recurrence, { tz }).next().toISOString();
if (!next) throw new Error(`--recurrence has no upcoming run: ${recurrence}`);
processAfter = next;
} else {
processAfter = parseProcessAfter(input.processAfter, tz);
}
return { name: input.name, prompt: input.prompt, recurrence, script, processAfter };
}
View on GitHub (pinned to 294ef2aee8)
Solutions
- Pass a non-empty prompt: prepareScheduledTask({ prompt: 'Summarize inbox', ... }).
- If generating tasks from templates/config, validate each entry has a prompt before calling prepareScheduledTask.
- Check for typos in the option key ('prompts', 'text', 'message' instead of 'prompt').
- Default it deliberately, e.g. prompt: input.prompt ?? fallbackText, only if a sensible default exists.
Example fix
// before
await prepareScheduledTask({ recurrence: '0 9 * * *' });
// after
await prepareScheduledTask({ prompt: 'Summarize the inbox', recurrence: '0 9 * * *' }); Defensive patterns
Strategy: validation
Validate before calling
if (!input?.prompt || !input.prompt.trim()) throw new Error('task prompt missing — refusing to call prepareScheduledTask'); Type guard
const hasPrompt = (t: { prompt?: string | null }): t is { prompt: string } => typeof t.prompt === 'string' && t.prompt.trim().length > 0; Prevention
- Make prompt a required TypeScript field in your own task type.
- Validate generated task lists (e.g. from templates) before mapping to prepareScheduledTask.
When it happens
Trigger: Calling prepareScheduledTask (directly or via a template task list / ncl tasks create) with prompt omitted, empty string, or undefined; building tasks programmatically from a config object where the prompt key is misspelled or conditionally unset.
Common situations: A template generates multiple tasks and one entry lacks a prompt field; a script constructs the task object dynamically and the prompt variable is undefined; users assuming recurrence alone is enough to define a task.
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
- invalid --recurrence: ${msg}
- --recurrence has no upcoming run: ${recurrence}
- ${flag} is required
- --status must be pending or paused
- session not found: ${sessionId}
AI-assisted analysis of nanocoai/nanoclaw@294ef2aee8 (2026-08-28).
Data as JSON: /api/errors/bd1c2313e68c498c.
Report an issue: GitHub.