tinyhumansai/openhuman · error

every_ms overflowed DateTime

Error message

every_ms overflowed DateTime

What it means

Computing the next fire time for an `every_ms` interval schedule overflowed chrono's DateTime range: adding the interval millis to the base time left representable time. Guard on the arithmetic, not on every_ms itself (a separate check rejects 0); large interval values are the trigger.

Source

Thrown at src/openhuman/cron/schedule.rs:55

                } else {
                    return Ok(next_utc);
                }
            }
            tracing::warn!(
                "[cron] no occurrence found within active_hours for expr={} after 100,000 candidates",
                expr
            );
            anyhow::bail!("No future occurrence found within active hours after 100,000 attempts")
        }
        Schedule::At { at } => Ok(*at),
        Schedule::Every { every_ms } => {
            if *every_ms == 0 {
                anyhow::bail!("Invalid schedule: every_ms must be > 0");
            }
            let ms = i64::try_from(*every_ms).context("every_ms is too large")?;
            let delta = ChronoDuration::milliseconds(ms);
            from.checked_add_signed(delta)
                .ok_or_else(|| anyhow::anyhow!("every_ms overflowed DateTime"))
        }
    }
}

pub fn validate_schedule(schedule: &Schedule, now: DateTime<Utc>) -> Result<()> {
    match schedule {
        Schedule::Cron {
            expr,
            tz,
            active_hours,
        } => {
            let _ = normalize_expression(expr)?;
            if let Some(active) = active_hours {
                let _ = ActiveWindow::parse(active)?;
            }
            let _ = ScheduleTimeZone::parse(tz.as_deref())?;
            let _ = next_run_for_schedule(schedule, now)?;
            Ok(())

View on GitHub (pinned to 7491200858)

Solutions

  1. Use a sane interval that keeps the next fire date within chrono's range
  2. Prefer cron expressions for very infrequent schedules
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/openhuman/cron/schedule.rs:55 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of tinyhumansai/openhuman@7491200858 (2026-08-17). Data as JSON: /api/errors/8913a625cda08707. Report an issue: GitHub.