{"record":{"id":"1880c70e4ef2096b","repo":"zeroclaw-labs/zeroclaw","slug":"unknown-agent-agent-alias-no-agents-agent-a","errorCode":null,"errorMessage":"Unknown agent {agent_alias:?} (no [agents.{agent_alias}] entry configured)","messagePattern":"Unknown agent (.+?) \\(no \\[agents\\.(.+?)\\] entry configured\\)","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src/cron/mod.rs","lineNumber":17,"sourceCode":"pub use zeroclaw_runtime::cron::*;\n\nuse crate::config::Config;\nuse anyhow::{Result, bail};\nuse zeroclaw_runtime::i18n::{get_required_cli_string, get_required_cli_string_with_args};\n\n/// Bail with a clear error if the named agent isn't configured.\nfn require_configured_agent(config: &Config, agent_alias: &str) -> Result<()> {\n    if config.agent(agent_alias).is_none() {\n        ::zeroclaw_log::record!(\n            WARN,\n            ::zeroclaw_log::Event::new(module_path!(), ::zeroclaw_log::Action::Reject)\n                .with_outcome(::zeroclaw_log::EventOutcome::Failure)\n                .with_attrs(::serde_json::json!({\"agent_alias\": agent_alias})),\n            \"cron CLI rejected: unknown agent alias\"\n        );\n        anyhow::bail!(\"Unknown agent {agent_alias:?} (no [agents.{agent_alias}] entry configured)\");\n    }\n    Ok(())\n}\n\nfn parse_explicit_rfc3339_utc(raw: &str) -> Result<chrono::DateTime<chrono::Utc>> {\n    chrono::DateTime::parse_from_rfc3339(raw)\n        .map(|timestamp| timestamp.with_timezone(&chrono::Utc))\n        .map_err(|err| {\n            ::zeroclaw_log::record!(\n                WARN,\n                ::zeroclaw_log::Event::new(module_path!(), ::zeroclaw_log::Action::Reject)\n                    .with_outcome(::zeroclaw_log::EventOutcome::Failure)\n                    .with_attrs(::serde_json::json!({\n                        \"raw\": raw,\n                        \"error\": format!(\"{}\", err),\n                    })),\n                \"cron --at rejected: timestamp lacks explicit Z/offset or is malformed\"\n            );","sourceCodeStart":1,"sourceCodeEnd":35,"githubUrl":"https://github.com/zeroclaw-labs/zeroclaw/blob/88bb9c8533fc57ed7a03e36ca7c9ed2bf8336dcc/src/cron/mod.rs#L1-L35","documentation":"Every cron subcommand resolves its agent through require_configured_agent, which requires an [agents.<alias>] table in the loaded zeroclaw config. When the alias has no such entry, the command is rejected (a Reject WARN event is logged with the alias) before anything is scheduled.","triggerScenarios":"Any `zeroclaw cron add|add-at|add-every|once|update <agent_alias> ...` invocation where the config file has no [agents.<agent_alias>] table: typo in the alias, alias renamed in config, or the wrong config file is being loaded.","commonSituations":"Fresh install with no agents configured yet; scripts written against an old alias after config reorganization; ZEROCLAW_CONFIG or --config pointing at a different file than expected; case mismatch in the alias.","solutions":["Open the active config file and check the exact spelling of the [agents.<alias>] tables; fix the command to use one of them.","If the agent is new, add its [agents.<alias>] section to the config first, then re-run the cron command.","Verify which config file zeroclaw actually loaded (env overrides, --config flag) if the table exists somewhere else.","Standardize scripts on the canonical alias instead of hardcoded names across environments."],"exampleFix":"# before: cron add references an unconfigured alias\nzeroclaw cron add my-bot --prompt 'daily report'\n# after: add the agent table first\n# zeroclaw.toml:\n# [agents.my-bot]\n# provider = \"openai\"\nzeroclaw cron add my-bot --prompt 'daily report'","handlingStrategy":"validation","validationCode":"use serde::Deserialize;\n#[derive(Deserialize)]\nstruct Config { agents: std::collections::BTreeMap<String, serde_json::Value> }\nfn agent_exists(cfg_text: &str, alias: &str) -> bool {\n    toml::from_str::<Config>(cfg_text)\n        .map(|c| c.agents.contains_key(alias))\n        .unwrap_or(false)\n}\n// validate alias against the same config zeroclaw loads before running cron cmds","typeGuard":null,"tryCatchPattern":"match handle_cron(cmd).await {\n    Err(e) if e.to_string().starts_with(\"Unknown agent\") => {\n        // bad alias: check [agents.*] tables in the active config, fix and retry\n    }\n    other => other,\n}","preventionTips":["Define all agent aliases in one reviewed config change before scheduling jobs against them.","Validate alias arguments against the config in wrapper scripts before invoking cron subcommands.","Pin the config path explicitly (--config / env) in automation so aliases resolve against the expected file."],"tags":["cron","config","agent-alias","cli"],"backgroundTag":"missing-config-entry","analyzedSha":"88bb9c8533fc57ed7a03e36ca7c9ed2bf8336dcc","analyzedAt":"2026-08-23T01:07:41.857Z","schemaVersion":2},"datasetVersion":"2026-08-23T08:06:27.607Z"}