{"record":{"id":"f53787383c3c4d40","repo":"Hmbown/CodeWhale","slug":"cron-field-name-value-value-is-out-of-range-m","errorCode":null,"errorMessage":"CRON {field_name} value {value} is out of range {min}-{max}","messagePattern":"CRON (.+?) value (.+?) is out of range (.+?)-(.+?)","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/tui/src/automation_manager.rs","lineNumber":960,"sourceCode":"        self.0\n            .iter()\n            .find_map(|(name, value)| (*name == needle).then_some(*value))\n    }\n}\n\nfn parse_cron_atom(\n    raw: &str,\n    min: u32,\n    max: u32,\n    names: CronNameMap,\n    field_name: &str,\n) -> Result<u32> {\n    let value = names\n        .lookup(raw)\n        .or_else(|| raw.parse::<u32>().ok())\n        .ok_or_else(|| anyhow::anyhow!(\"Invalid CRON {field_name} value '{raw}'\"))?;\n    if !(min..=max).contains(&value) {\n        bail!(\"CRON {field_name} value {value} is out of range {min}-{max}\");\n    }\n    Ok(value)\n}\n\nfn weekday_to_cron(day: Weekday) -> u32 {\n    match day {\n        Weekday::Sun => 0,\n        Weekday::Mon => 1,\n        Weekday::Tue => 2,\n        Weekday::Wed => 3,\n        Weekday::Thu => 4,\n        Weekday::Fri => 5,\n        Weekday::Sat => 6,\n    }\n}\n\nfn days_in_month(year: i32, month: u32) -> u32 {\n    match month {","sourceCodeStart":942,"sourceCodeEnd":978,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/automation_manager.rs#L942-L978","documentation":"After resolving a field atom (either via the name map, e.g. month/weekday names, or numeric parse), parse_cron_atom checks the value against the field's allowed min..=max and rejects out-of-range values. This is the bounds check for validly-formatted numbers like 60 in minutes or 13 in a 1-12 month field.","triggerScenarios":"A value that parses as u32 but exceeds the field's range: minute 60+, hour 24+, day-of-month 0 or 32+, month 13+, weekday 8+ (given the field's min/max).","commonSituations":"Off-by-one confusion (months 0-11 vs 1-12; hours 0-23 vs 1-24); typo '0 0 * * 9' for weekday; reusing seconds-style 0-59 values in a minute field.","solutions":["Move the value into the field's documented range, e.g. month 12 not 13, minute 59 not 60","Check the numbering convention for named fields (cron months are 1-12, weekdays 0-7 with 0=Sunday)","Fix the source variable or config value producing the out-of-range number"],"exampleFix":"// before\n\"0 0 * * 8\" // weekday 8 out of range\n// after\n\"0 0 * * 0\" // Sunday (0-6)","handlingStrategy":"validation","validationCode":"fn in_range(v: u32, min: u32, max: u32) -> bool { (min..=max).contains(&v) }\nassert!(in_range(minute, 0, 59));","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep a table of field ranges: minute 0-59, hour 0-23, dom 1-31, month 1-12, weekday 0-6","Validate user/config-supplied numbers per field before composing the expression","Watch for 0-based vs 1-based month conventions when porting from other schedulers"],"tags":["cron","validation","range"],"backgroundTag":"value-out-of-range","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"}