Hmbown/CodeWhale · warning

HOURLY schedule exceeded its range

Error message

HOURLY schedule exceeded its range

What it means

Computing the next anchored HOURLY run multiplies INTERVAL (hours) by a step count with i64::checked_mul; this error means that multiplication overflowed, i.e. the schedule's anchor/elapsed arithmetic left the i64 range. It is a defensive guard: values produced by validated configs cannot plausibly reach it.

Source

Thrown at crates/tui/src/automation_manager.rs:454

                    let anchor_naive = local_anchor_reference
                        .date_naive()
                        .and_hms_opt(hour, minute, 0)
                        .ok_or_else(|| anyhow::anyhow!("Unable to construct HOURLY anchor"))?;
                    let interval_seconds = i64::from(*interval_hours) * 60 * 60;
                    let elapsed_seconds = local_after
                        .naive_local()
                        .signed_duration_since(anchor_naive)
                        .num_seconds();
                    let mut steps = if elapsed_seconds < 0 {
                        0
                    } else {
                        elapsed_seconds / interval_seconds + 1
                    };

                    for _ in 0..MAX_HOURLY_SEARCH_STEPS {
                        let hours = i64::from(*interval_hours)
                            .checked_mul(steps)
                            .ok_or_else(|| anyhow::anyhow!("HOURLY schedule exceeded its range"))?;
                        let delta = Duration::try_hours(hours)
                            .ok_or_else(|| anyhow::anyhow!("HOURLY schedule exceeded its range"))?;
                        let candidate_naive = anchor_naive
                            .checked_add_signed(delta)
                            .ok_or_else(|| anyhow::anyhow!("HOURLY schedule exceeded its range"))?;

                        if byday
                            .as_ref()
                            .is_none_or(|days| days.contains(&candidate_naive.weekday()))
                            && 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 8880682c63)

Solutions

  1. Sanity-check INTERVAL (e.g. 1..=8760) before saving or scheduling the automation
  2. Re-create the automation with a sane INTERVAL via the supported tooling
  3. If the record was produced by current tooling, report it: this overflow should be unreachable

Example fix

// before
"FREQ=HOURLY;INTERVAL=4000000000" // corrupted stored record
// after
"FREQ=HOURLY;INTERVAL=24"
Defensive patterns

Strategy: validation

Validate before calling

let interval: u32 = parts.get("INTERVAL").copied().unwrap_or("1").parse()?;
ensure!((1..=8760).contains(&interval), "INTERVAL must be between 1 and 8760 hours");

Type guard

fn hourly_interval_is_sane(rrule: &str) -> bool {
    rrule
        .split(';')
        .find_map(|kv| kv.split_once('=').filter(|(k, _)| k == "INTERVAL").map(|(_, v)| v))
        .and_then(|v| v.parse::<u32>().ok())
        .is_none_or(|i| (1..=8760).contains(&i))
}

Prevention

When it happens

Trigger: A corrupted or hand-edited stored automation with an absurd INTERVAL, or an anchor positioned so the elapsed-seconds step count times INTERVAL exceeds i64; reached only via records that skipped parse-time validation.

Common situations: Hand-edited automation store entries; data corruption; records written by a buggy older version.

Related errors


AI-assisted analysis of Hmbown/CodeWhale@8880682c63 (2026-08-16). Data as JSON: /api/errors/f121fac3b91bb871. Report an issue: GitHub.