{"record":{"id":"cc066232a0037e38","repo":"Hmbown/CodeWhale","slug":"cron-schedules-require-expr","errorCode":null,"errorMessage":"CRON schedules require EXPR","messagePattern":"CRON schedules require EXPR","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/automation_manager.rs","lineNumber":721,"sourceCode":"    }\n    let raw_at = parts\n        .get(\"AT\")\n        .ok_or_else(|| anyhow::anyhow!(\"ONCE schedules require AT\"))?;\n    let at = parse_once_at(raw_at)?;\n    Ok(AutomationSchedule::Once { at })\n}\n\nfn parse_cron_schedule(parts: &BTreeMap<String, String>) -> Result<AutomationSchedule> {\n    for key in parts.keys() {\n        if key != \"FREQ\" && key != \"EXPR\" {\n            bail!(\"Unsupported RRULE field '{key}' for CRON. Allowed: FREQ,EXPR\");\n        }\n    }\n    let expr = parts\n        .get(\"EXPR\")\n        .map(|value| value.trim().to_string())\n        .filter(|value| !value.is_empty())\n        .ok_or_else(|| anyhow::anyhow!(\"CRON schedules require EXPR\"))?;\n    ParsedCronExpr::parse(&expr)?;\n    Ok(AutomationSchedule::Cron { expr })\n}\n\nfn parse_once_at(raw: &str) -> Result<DateTime<Utc>> {\n    let trimmed = raw.trim();\n    if let Ok(at) = DateTime::parse_from_rfc3339(trimmed) {\n        return Ok(at.with_timezone(&Utc));\n    }\n    for format in [\"%Y-%m-%dT%H:%M:%S\", \"%Y-%m-%dT%H:%M\"] {\n        if let Ok(naive) = NaiveDateTime::parse_from_str(trimmed, format) {\n            return resolve_local_datetime(&Local, naive)\n                .map(|value| value.with_timezone(&Utc))\n                .ok_or_else(|| anyhow::anyhow!(\"ONCE local time does not exist: {trimmed}\"));\n        }\n    }\n    bail!(\"Failed to parse ONCE AT '{trimmed}'. Use local YYYY-MM-DDTHH:MM[:SS] or RFC3339\")\n}","sourceCodeStart":703,"sourceCodeEnd":739,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/automation_manager.rs#L703-L739","documentation":"RRULE parse guard for CRON frequency: only FREQ and EXPR are allowed keys, and the EXPR value is missing or trims to empty. Without an expression there is no cron schedule to parse, so the guard fires before ParsedCronExpr::parse.","triggerScenarios":"Thrown at crates/tui/src/automation_manager.rs:721 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Provide a non-empty EXPR value, e.g. FREQ=CRON;EXPR=0 9 * * 1-5.","Fix whitespace-only values — the field is trimmed and must still contain the expression."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"73e0f67d83c59909b571efdfc88c4bc28c309cb1","analyzedAt":"2026-09-22T01:30:00.501Z","contentChangedAt":"2026-09-22T01:30:00.501Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}