Hmbown/CodeWhale · error · anyhow::Error
Unable to compute next WEEKLY run
Error message
Unable to compute next WEEKLY run
What it means
For a WEEKLY schedule, next_after_in_timezone scans day offsets 0..15 from `after`, checking each date's weekday against BYDAY and building the wall time from BYHOUR/BYMINUTE. If no candidate in the next 15 days matches a BYDAY weekday and resolves to a real local time strictly after `after`, it bails. Since every weekday recurs within 7 days, exhaustion almost always means BYDAY is empty (no allowed weekdays) or every candidate fails local-time resolution.
Solutions
- Provide a non-empty BYDAY list (e.g. BYDAY=MO,WE) for the WEEKLY schedule.
- Check BYHOUR/BYMINUTE values (0-23 / 0-59) and avoid times inside a DST transition gap.
- Re-save the automation to regenerate a valid schedule if the stored RRULE looks corrupted.
Example fix
// before "FREQ=WEEKLY;BYDAY=;BYHOUR=9;BYMINUTE=0" // after "FREQ=WEEKLY;BYDAY=MO,WE,FR;BYHOUR=9;BYMINUTE=0"
Defensive patterns
Strategy: validation
Validate before calling
if byday.is_empty() {
return Err("WEEKLY schedule requires at least one BYDAY value");
}
if byhour > 23 || byminute > 59 {
return Err("BYHOUR/BYMINUTE out of range");
} Try / catch
match schedule.next_after_with_anchor(now, anchor) {
Ok(next) => arm(next),
Err(e) if e.to_string().contains("next WEEKLY run") => mark_schedule_broken(),
Err(e) => report(e),
} Prevention
- Require a non-empty BYDAY list for WEEKLY schedules in the editor.
- Avoid BYHOUR times inside DST spring-forward gaps.
- Recompute the next run on save as a smoke test.
When it happens
Trigger: AutomationSchedule::Weekly whose byday vector is empty (parse produced no days), or whose byhour/byminute land in a DST-gap every candidate day, or day_offset bound exhausted because `after` was supplied inconsistently with byday.
Common situations: An RRULE like FREQ=WEEKLY;BYDAY= saved with an empty or whitespace BYDAY value; a schedule whose BYHOUR falls inside a spring-forward gap; corrupted persisted schedule state.
Understand the failure class
Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.
Related errors
- Unable to compute next anchored HOURLY run
- Unable to compute next HOURLY run for BYDAY filter
- Claimed delayed trigger has no durable task binding
- HOURLY schedule exceeded its range
- Once schedule has no future run after
AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22).
Data as JSON: /api/errors/c4e9a954b1343c13.
Report an issue: GitHub.
Appendix: source
Thrown at crates/tui/src/automation_manager.rs:577
byday,
byhour,
byminute,
} => {
for day_offset in 0..15 {
let date = local_after.date_naive() + Duration::days(i64::from(day_offset));
if !byday.contains(&date.weekday()) {
continue;
}
let Some(candidate_naive) = date.and_hms_opt(*byhour, *byminute, 0) else {
continue;
};
if let Some(candidate) = resolve_local_datetime(timezone, candidate_naive)
&& candidate.with_timezone(&Utc) > after
{
return Ok(candidate.with_timezone(&Utc));
}
}
bail!("Unable to compute next WEEKLY run");
}
Self::Cron { expr } => {
let cron = ParsedCronExpr::parse(expr)?;
let mut candidate_naive = local_after
.naive_local()
.with_second(0)
.and_then(|dt| dt.with_nanosecond(0))
.ok_or_else(|| anyhow::anyhow!("Unable to round CRON search start"))?
.checked_add_signed(Duration::minutes(1))
.ok_or_else(|| anyhow::anyhow!("CRON schedule exceeded its range"))?;
for _ in 0..MAX_CRON_SEARCH_MINUTES {
if cron.matches(candidate_naive)
&& let Some(candidate) = resolve_local_datetime(timezone, candidate_naive)
{
let candidate = candidate.with_timezone(&Utc);
if candidate > after {
return Ok(candidate);View on GitHub (pinned to 73e0f67d83)