zeroclaw-labs/zeroclaw · error · anyhow::Error

cli-cron-update-no-field

cli-cron-update-no-field

Error message

At least one of --expression, --tz, --command, --name, --allowed-tool, --uses-memory, or a delivery flag (--channel, --to, --thread, --best-effort, --no-best-effort) must be provided

What it means

`cron update` is a patch operation: only the fields you name change. The command therefore requires at least one of --expression, --tz, --command, --name, --allowed-tool, --uses-memory, or a delivery flag (--channel, --to, --thread, --best-effort, --no-best-effort). With none provided, it aborts immediately (i18n key 'cli-cron-update-no-field') rather than performing a silent no-op.

Source

Thrown at src/cron/mod.rs:544

            expression,
            tz,
            command,
            name,
            allowed_tools,
            uses_memory,
            delivery,
        } => {
            require_configured_agent(config, &agent_alias)?;
            let delivery_requested = delivery.any_set();
            if expression.is_none()
                && tz.is_none()
                && command.is_none()
                && name.is_none()
                && allowed_tools.is_empty()
                && uses_memory.is_none()
                && !delivery_requested
            {
                bail!("{}", get_required_cli_string("cli-cron-update-no-field"));
            }

            let existing = if expression.is_some()
                || tz.is_some()
                || !allowed_tools.is_empty()
                || delivery_requested
            {
                Some(get_job(config, &id)?)
            } else {
                None
            };

            // Delivery flags are a patch over the stored config, matching this
            // command's contract that only the fields you name change. The
            // create paths validate inside `add_*_with_approval`; the update
            // path does not, so validate the merged result here.
            let delivery = if delivery_requested {
                let existing = existing

View on GitHub (pinned to 88bb9c8533)

Solutions

  1. Add the field you want to change, e.g. `zeroclaw cron update <id> --name weekly` or `--expression '0 5 * * 1'`.
  2. If you meant to inspect rather than change the job, use the list/show command instead.
  3. In scripts, skip the update call entirely when the computed patch set is empty, and assert at least one flag when building the command line.

Example fix

# before (script runs update with no flags)
zeroclaw cron update abc123
# after (guard in the caller)
if [ -n "$EXPR" ] || [ -n "$NAME" ]; then
  zeroclaw cron update abc123 ${EXPR:+--expression "$EXPR"} ${NAME:+--name "$NAME"}
fi
Defensive patterns

Strategy: validation

Validate before calling

struct CronPatch<'a> {
    expression: Option<&'a str>, tz: Option<&'a str>, command: Option<&'a str>,
    name: Option<&'a str>, allowed_tools: &'a [String], uses_memory: Option<bool>,
    delivery_any: bool,
}
impl CronPatch<'_> {
    fn is_empty(&self) -> bool {
        self.expression.is_none() && self.tz.is_none() && self.command.is_none()
            && self.name.is_none() && self.allowed_tools.is_empty()
            && self.uses_memory.is_none() && !self.delivery_any
    }
}
// skip the `cron update` call when patch.is_empty()

Try / catch

match run_cron_update(args).await {
    Err(e) if e.to_string().contains("must be provided") => {
        // no-op patch: log and continue; nothing to fix on the CLI side
    }
    other => other,
}

Prevention

When it happens

Trigger: `zeroclaw cron update <id>` (optionally with just the agent alias) and no mutation flags — commonly when a script conditionally builds its flag list and every condition evaluated false.

Common situations: Wrapper scripts passing flags only when variables are set (all empty in some runs); users expecting 'update' to refresh or re-arm a job; copy-paste commands that lost their flags.

Related errors


AI-assisted analysis of zeroclaw-labs/zeroclaw@88bb9c8533 (2026-08-23). Data as JSON: /api/errors/f07503000fda8139. Report an issue: GitHub.