Hmbown/CodeWhale · error

CRON schedule exceeded its range

Error message

CRON schedule exceeded its range

What it means

CRON next-run search exhausted its candidate range without finding an occurrence after the given time; either the expression matches nothing in range or it is unsatisfiable, so the scheduler fails instead of looping forever.

Solutions

  1. Narrow the CRON expression's ranges so iteration over the search window yields valid candidates.
  2. Verify the expression with a cron parser before saving the automation.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/tui/src/automation_manager.rs:587 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22). Data as JSON: /api/errors/f3aa1b8fdea702d6. Report an issue: GitHub.

Appendix: source

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

                        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 73e0f67d83)