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

--allowed-tool is only supported for agent cron jobs

Error message

--allowed-tool is only supported for agent cron jobs

What it means

When `cron update` receives --allowed-tool values, it loads the existing job and requires its job_type to be JobType::Agent. Tool allowlists exist only for agent prompt jobs; updating a shell job (--command job) with an allowlist is rejected before the CronJobPatch is built, leaving the job unchanged.

Source

Thrown at src/cron/mod.rs:599

                        expr,
                        tz: existing_tz,
                    } => (expr.clone(), existing_tz.clone()),
                    _ => bail!("Cannot update expression/tz on a non-cron schedule"),
                };
                Some(Schedule::Cron {
                    expr: expression.unwrap_or(existing_expr),
                    tz: tz.or(existing_tz),
                })
            } else {
                None
            };

            if !allowed_tools.is_empty() {
                let existing = existing
                    .as_ref()
                    .expect("existing job must be loaded when updating allowed tools");
                if existing.job_type != JobType::Agent {
                    bail!("--allowed-tool is only supported for agent cron jobs");
                }
            }

            let patch = CronJobPatch {
                schedule,
                command,
                name,
                allowed_tools: if allowed_tools.is_empty() {
                    None
                } else {
                    Some(allowed_tools)
                },
                uses_memory,
                delivery,
                ..CronJobPatch::default()
            };

            let job = update_shell_job_with_approval(config, &agent_alias, &id, patch, false)?;

View on GitHub (pinned to 88bb9c8533)

Solutions

  1. Remove --allowed-tool from the update command for shell jobs.
  2. If the allowlist matters, recreate the job as a prompt job (delete + `cron add ... --prompt ... --allowed-tool ...`).
  3. In bulk-update scripts, look up each job's type before deciding whether to emit allowlist flags.

Example fix

# before
zeroclaw cron update abc123 --allowed-tool bash   # abc123 is a --command job
# after: recreate as an agent prompt job
zeroclaw cron remove abc123
zeroclaw cron add bot --expression '0 5 * * *' --prompt 'run backup' --allowed-tool bash
Defensive patterns

Strategy: validation

Validate before calling

// before `cron update <id> --allowed-tool ...`, check the job's type
// `zeroclaw cron list` shows prompt jobs vs command jobs; only send
// --allowed-tool when the job was created with --prompt

Try / catch

match run_cron_update(args).await {
    Err(e) if e.to_string().contains("only supported for agent cron jobs") => {
        // shell job: drop the allowlist flags; or recreate as a prompt job
    }
    other => other,
}

Prevention

When it happens

Trigger: `zeroclaw cron update <id> --allowed-tool bash` where job <id> was created without --prompt (shell job via add/add-at/add-every/once), so its job_type is not Agent.

Common situations: Trying to add restrictions to an existing shell job after the fact; scripts applying a uniform allowlist update to every job id; converting jobs by patching flags instead of recreating them.

Related errors


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