Hmbown/CodeWhale · error · anyhow::Error
Once schedule has no future run after
Error message
Once schedule has no future run after {} What it means
AutomationSchedule::next_after_in_timezone throws this for a Once schedule whose single run time `at` is not strictly after the requested `after` instant. A one-shot automation has exactly one occurrence, so if that instant has already passed there is no future run to return. It surfaces as an anyhow bail from the schedule iterator when the automation is evaluated after its scheduled time.
Solutions
- Pick a future AT time when creating the ONCE automation (delete/recreate or edit the schedule with FREQ=ONCE;AT=<future RFC3339 or local time>).
- Validate before saving: reject ONCE schedules whose parsed `at` is not in the future.
- If the caller just wants to know there is nothing pending, treat this error as an empty result rather than a failure (next_after_slot already returns Ok(None) for Once).
Example fix
// before
AutomationSchedule::parse("FREQ=ONCE;AT=2020-01-01T09:00")
// after
AutomationSchedule::parse("FREQ=ONCE;AT=2026-12-01T09:00:00") Defensive patterns
Strategy: validation
Validate before calling
let at: chrono::DateTime<chrono::Utc> = parse_at(input)?;
if at <= chrono::Utc::now() {
return Err("ONCE schedule time must be in the future");
} Try / catch
match schedule.next_after_with_anchor(now, anchor) {
Ok(next) => arm(next),
Err(e) if e.to_string().starts_with("Once schedule has no future run") => treat_as_completed(),
Err(e) => report(e),
} Prevention
- Default the UI's ONCE time picker to a future timestamp.
- Reject past AT values at schedule-creation time.
- Treat a passed ONCE schedule as 'completed' state instead of re-querying.
When it happens
Trigger: Calling next_after_with_anchor / next_after_in_timezone on an AutomationSchedule::Once whose `at` (parsed from RRULE FREQ=ONCE;AT=...) is <= the `after` DateTime<Utc> passed in — typically because the ONCE time already elapsed before evaluation.
Common situations: A user creates a one-shot automation for a time that has already passed (or in the past timezone), the TUI was suspended past the fire time and the scheduler re-queries, or the system clock jumped forward past the scheduled instant.
Related errors
- Claimed delayed trigger has no durable task binding
- HOURLY schedule exceeded its range
- Unable to compute next anchored HOURLY run
- Unable to compute next HOURLY run for BYDAY filter
- Unable to compute next WEEKLY run
AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22).
Data as JSON: /api/errors/3ce1f8f3578f4f47.
Report an issue: GitHub.
Appendix: source
Thrown at crates/tui/src/automation_manager.rs:480
after: DateTime<Utc>,
anchor_reference: DateTime<Utc>,
) -> Result<DateTime<Utc>> {
self.next_after_in_timezone(after, anchor_reference, &Local)
}
fn next_after_in_timezone<Tz: TimeZone>(
&self,
after: DateTime<Utc>,
anchor_reference: DateTime<Utc>,
timezone: &Tz,
) -> Result<DateTime<Utc>> {
let local_after = after.with_timezone(timezone);
match self {
Self::Once { at } => {
if *at > after {
Ok(*at)
} else {
bail!(
"Once schedule has no future run after {}",
after.to_rfc3339()
)
}
}
Self::Hourly {
interval_hours,
byday,
anchor_hour,
anchor_minute,
} => {
if anchor_hour.is_some() || anchor_minute.is_some() {
let local_anchor_reference = anchor_reference.with_timezone(timezone);
let hour = anchor_hour.unwrap_or(local_anchor_reference.hour());
let minute = anchor_minute.unwrap_or(0);
let anchor_naive = local_anchor_reference
.date_naive()
.and_hms_opt(hour, minute, 0)View on GitHub (pinned to 73e0f67d83)