Hmbown/CodeWhale · warning
CRON schedule exceeded its range
Error message
CRON schedule exceeded its range
What it means
After rounding the CRON search start to the minute, the first candidate is produced with checked_add_signed(Duration::minutes(1)); None means the start time sits so close to chrono's NaiveDateTime boundary (roughly year +/-262143) that adding one minute overflows. Defensive guard against a system clock or stored 'after' time at the edge of the representable calendar.
Source
Thrown at crates/tui/src/automation_manager.rs:527
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);
}
}
candidate_naive = candidate_naive
.checked_add_signed(Duration::minutes(1))
.ok_or_else(|| anyhow::anyhow!("CRON schedule exceeded its range"))?;
}
bail!("Unable to compute next CRON run within 5 years");
}
}
}View on GitHub (pinned to 8880682c63)
Solutions
- Check and correct the system clock if it shows an extreme date
- Re-create the automation so its stored slot is recomputed from the real clock
- Validate persisted slot values are within a sane range before loading
Defensive patterns
Strategy: validation
Validate before calling
let year = chrono::Local::now().year();
ensure!((1970..=9999).contains(&year), "system clock year {year} is not usable for scheduling"); Type guard
fn datetime_in_sane_range(dt: chrono::DateTime<chrono::Utc>) -> bool {
(1970..=9999).contains(&dt.year())
} Prevention
- Validate the system clock at scheduler startup (NTP, sane year range)
- Bounds-check persisted next-run slots when loading the automation store
- Recreate automations after clock-corruption events instead of trusting stored slots
When it happens
Trigger: A CRON automation evaluated when local_after (now, or a persisted next-run value) is at or beyond the chrono datetime range — e.g. a corrupted stored slot or a misconfigured system clock set to an extreme year.
Common situations: Corrupted automation records with extreme datetimes; broken RTC/clock skew to absurd dates; not reachable with a sane clock.
Related errors
- HOURLY schedule exceeded its range
- Unable to round CRON search start
- Unable to construct HOURLY anchor
- CRON schedules require EXPR
- Invalid CRON {field_name} value '{raw}'
AI-assisted analysis of Hmbown/CodeWhale@8880682c63 (2026-08-16).
Data as JSON: /api/errors/f3aa1b8fdea702d6.
Report an issue: GitHub.