{"record":{"id":"8913a625cda08707","repo":"tinyhumansai/openhuman","slug":"every-ms-overflowed-datetime","errorCode":null,"errorMessage":"every_ms overflowed DateTime","messagePattern":"every_ms overflowed DateTime","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/openhuman/cron/schedule.rs","lineNumber":55,"sourceCode":"                } else {\n                    return Ok(next_utc);\n                }\n            }\n            tracing::warn!(\n                \"[cron] no occurrence found within active_hours for expr={} after 100,000 candidates\",\n                expr\n            );\n            anyhow::bail!(\"No future occurrence found within active hours after 100,000 attempts\")\n        }\n        Schedule::At { at } => Ok(*at),\n        Schedule::Every { every_ms } => {\n            if *every_ms == 0 {\n                anyhow::bail!(\"Invalid schedule: every_ms must be > 0\");\n            }\n            let ms = i64::try_from(*every_ms).context(\"every_ms is too large\")?;\n            let delta = ChronoDuration::milliseconds(ms);\n            from.checked_add_signed(delta)\n                .ok_or_else(|| anyhow::anyhow!(\"every_ms overflowed DateTime\"))\n        }\n    }\n}\n\npub fn validate_schedule(schedule: &Schedule, now: DateTime<Utc>) -> Result<()> {\n    match schedule {\n        Schedule::Cron {\n            expr,\n            tz,\n            active_hours,\n        } => {\n            let _ = normalize_expression(expr)?;\n            if let Some(active) = active_hours {\n                let _ = ActiveWindow::parse(active)?;\n            }\n            let _ = ScheduleTimeZone::parse(tz.as_deref())?;\n            let _ = next_run_for_schedule(schedule, now)?;\n            Ok(())","sourceCodeStart":37,"sourceCodeEnd":73,"githubUrl":"https://github.com/tinyhumansai/openhuman/blob/749120085864ce16e0f273c7b86fac7740b39c5b/src/openhuman/cron/schedule.rs#L37-L73","documentation":"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.","triggerScenarios":"Thrown at src/openhuman/cron/schedule.rs:55 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use a sane interval that keeps the next fire date within chrono's range","Prefer cron expressions for very infrequent schedules"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"749120085864ce16e0f273c7b86fac7740b39c5b","analyzedAt":"2026-08-17T21:21:45.363Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}