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

Cron job ' ': shell_output_format is shell-only and cannot…

Error message

Cron job '{job_id}': shell_output_format is shell-only and cannot be set on a '{job_type}' job

What it means

update_job_inner refuses to persist shell_output_format on a cron job whose type is not 'shell'. The field only shapes how shell job output is captured/formatted; on agent-type jobs it would be dead data the executor never consumes, so the core update path rejects the patch instead of silently ignoring or storing it.

Solutions

  1. Only set shell_output_format on shell-type cron jobs.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/zeroclaw-runtime/src/cron/store.rs:549 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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

Appendix: source

Thrown at crates/zeroclaw-runtime/src/cron/store.rs:549

    }
    if let Some(uses_memory) = patch.uses_memory {
        job.uses_memory = uses_memory;
    }
    if let Some(shell_output_format) = patch.shell_output_format {
        // Config-owned (declarative) and non-shell (agent) jobs never store
        // this field: the gateway API already rejects both cases, but this
        // is the core boundary every caller of `update_job` goes through,
        // so it must reject them too rather than silently ignoring or
        // persisting a value execution never consumes.
        if job.source == "declarative" {
            anyhow::bail!(
                "Cron job '{job_id}': shell_output_format is owned by config.toml for a \
                 declarative job, not the database"
            );
        }
        if job.job_type != JobType::Shell {
            let job_type: &str = job.job_type.into();
            anyhow::bail!(
                "Cron job '{job_id}': shell_output_format is shell-only and cannot be set on a '{job_type}' job"
            );
        }
        job.shell_output_format = shell_output_format;
    }

    if schedule_changed {
        job.next_run = next_run_for_schedule(&job.schedule, Utc::now())?;
    }

    with_initialized_connection(config, |conn| {
        // Declarative jobs don't own `shell_output_format` — the config is the
        // canonical source, and `resolve_declarative_shell_output_format()` overlays
        // it on every read. Writing the synthesized (Wrapped) value back into the
        // column during an unrelated patch would overwrite whatever was stored
        // there (NULL, garbage, or a future value) with a value the DB doesn't
        // own. Omit the column from the UPDATE for declarative rows so the
        // non-owned shadow stays untouched.

View on GitHub (pinned to 88bb9c8533)