{"record":{"id":"d8533accfa5f9766","repo":"Hmbown/CodeWhale","slug":"unable-to-compute-next-hourly-run-for-byday-filter","errorCode":null,"errorMessage":"Unable to compute next HOURLY run for BYDAY filter","messagePattern":"Unable to compute next HOURLY run for BYDAY filter","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/tui/src/automation_manager.rs","lineNumber":553,"sourceCode":"                            .ok_or_else(|| anyhow::anyhow!(\"HOURLY schedule exceeded its range\"))?;\n                    }\n                    bail!(\"Unable to compute next anchored HOURLY run\");\n                }\n\n                let after_second = local_after.second();\n                let after_nanosecond = local_after.nanosecond();\n                let mut candidate = local_after + Duration::hours(i64::from(*interval_hours))\n                    - Duration::seconds(i64::from(after_second))\n                    - Duration::nanoseconds(i64::from(after_nanosecond));\n\n                if let Some(days) = byday {\n                    for _ in 0..(24 * 21) {\n                        if days.contains(&candidate.weekday()) {\n                            return Ok(candidate.with_timezone(&Utc));\n                        }\n                        candidate += Duration::hours(i64::from(*interval_hours));\n                    }\n                    bail!(\"Unable to compute next HOURLY run for BYDAY filter\");\n                }\n\n                Ok(candidate.with_timezone(&Utc))\n            }\n            Self::Weekly {\n                byday,\n                byhour,\n                byminute,\n            } => {\n                for day_offset in 0..15 {\n                    let date = local_after.date_naive() + Duration::days(i64::from(day_offset));\n                    if !byday.contains(&date.weekday()) {\n                        continue;\n                    }\n                    let Some(candidate_naive) = date.and_hms_opt(*byhour, *byminute, 0) else {\n                        continue;\n                    };\n                    if let Some(candidate) = resolve_local_datetime(timezone, candidate_naive)","sourceCodeStart":535,"sourceCodeEnd":571,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/automation_manager.rs#L535-L571","documentation":"For an unanchored HOURLY schedule with a BYDAY weekday filter, the code advances the candidate by interval_hours up to 24*21 times (three weeks of hourly steps) looking for a weekday in the filter. If none of those candidates lands on an allowed weekday, it bails with this message. It is a bounded-search exhaustion, meaning the BYDAY filter is unreachable on the schedule's interval grid within three weeks.","triggerScenarios":"AutomationSchedule::Hourly with byday set and an interval_hours so large that interval hops skip over every allowed weekday within the 21-day search window (e.g. INTERVAL > 168 hours can hop week to week past all filtered days).","commonSituations":"Interval larger than a week combined with BYDAY; BYDAY list that never coincides with the candidate grid; typo in the stored RRULE giving a nonsensical interval.","solutions":["Lower INTERVAL so the hourly grid lands on a BYDAY weekday within three weeks (INTERVAL < 168).","Broaden BYDAY to include more weekdays.","Use FREQ=WEEKLY with BYDAY/BYHOUR/BYMINUTE instead of a huge hourly interval plus day filter."],"exampleFix":"// before\n\"FREQ=HOURLY;INTERVAL=200;BYDAY=MO\"\n// after\n\"FREQ=WEEKLY;BYDAY=MO;BYHOUR=9;BYMINUTE=0\"","handlingStrategy":"validation","validationCode":"if schedule_is_hourly() && interval_hours >= 168 && !byday.is_empty() {\n    return Err(\"HOURLY interval >= 1 week with BYDAY can never match\");\n}","typeGuard":null,"tryCatchPattern":"match schedule.next_after_with_anchor(now, anchor) {\n    Ok(next) => arm(next),\n    Err(e) if e.to_string().contains(\"BYDAY filter\") => surface_config_warning(),\n    Err(e) => report(e),\n}","preventionTips":["Keep hourly intervals well under a week when filtering by weekday.","Express weekly cadence with FREQ=WEEKLY instead of large hourly intervals.","Test the schedule once at creation by computing next_after_with_anchor."],"tags":["scheduling","automation","bounds"],"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"}