{"record":{"id":"c4e9a954b1343c13","repo":"Hmbown/CodeWhale","slug":"unable-to-compute-next-weekly-run","errorCode":null,"errorMessage":"Unable to compute next WEEKLY run","messagePattern":"Unable to compute next WEEKLY run","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/tui/src/automation_manager.rs","lineNumber":577,"sourceCode":"                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)\n                        && candidate.with_timezone(&Utc) > after\n                    {\n                        return Ok(candidate.with_timezone(&Utc));\n                    }\n                }\n                bail!(\"Unable to compute next WEEKLY run\");\n            }\n            Self::Cron { expr } => {\n                let cron = ParsedCronExpr::parse(expr)?;\n                let mut candidate_naive = local_after\n                    .naive_local()\n                    .with_second(0)\n                    .and_then(|dt| dt.with_nanosecond(0))\n                    .ok_or_else(|| anyhow::anyhow!(\"Unable to round CRON search start\"))?\n                    .checked_add_signed(Duration::minutes(1))\n                    .ok_or_else(|| anyhow::anyhow!(\"CRON schedule exceeded its range\"))?;\n\n                for _ in 0..MAX_CRON_SEARCH_MINUTES {\n                    if cron.matches(candidate_naive)\n                        && let Some(candidate) = resolve_local_datetime(timezone, candidate_naive)\n                    {\n                        let candidate = candidate.with_timezone(&Utc);\n                        if candidate > after {\n                            return Ok(candidate);","sourceCodeStart":559,"sourceCodeEnd":595,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/automation_manager.rs#L559-L595","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\n\"FREQ=WEEKLY;BYDAY=;BYHOUR=9;BYMINUTE=0\"\n// after\n\"FREQ=WEEKLY;BYDAY=MO,WE,FR;BYHOUR=9;BYMINUTE=0\"","handlingStrategy":"validation","validationCode":"if byday.is_empty() {\n    return Err(\"WEEKLY schedule requires at least one BYDAY value\");\n}\nif byhour > 23 || byminute > 59 {\n    return Err(\"BYHOUR/BYMINUTE out of range\");\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(\"next WEEKLY run\") => mark_schedule_broken(),\n    Err(e) => report(e),\n}","preventionTips":["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."],"tags":["scheduling","automation","bounds"],"backgroundTag":"empty-required-field","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"}