Hmbown/CodeWhale · error · anyhow::Error

INTERVAL must be >= 1 for HOURLY schedules

Error message

INTERVAL must be >= 1 for HOURLY schedules

What it means

HOURLY schedules accept an INTERVAL that shifts the run every N hours; an INTERVAL of 0 would never advance and is rejected. The parser parses INTERVAL as u32 and enforces >= 1 (1 being the default when omitted).

Solutions

  1. Set INTERVAL to 1 or greater (omit it entirely for every hour)
  2. Fix template/variable substitution so empty values don't become 0
  3. Validate INTERVAL > 0 before writing the automation config

Example fix

// before
RRULE:FREQ=HOURLY;INTERVAL=0
// after
RRULE:FREQ=HOURLY;INTERVAL=1
Defensive patterns

Strategy: validation

Validate before calling

const interval = Number(rule.match(/INTERVAL=(\d+)/)?.[1] ?? 1);
if (interval < 1) throw new Error("INTERVAL must be >= 1 for HOURLY schedules");

Try / catch

try {
  parse_rrule(rule)?;
} catch e if e.to_string().contains("INTERVAL must be >= 1") {
  eprintln!("{e}; defaulting to INTERVAL=1");
}

Prevention

When it happens

Trigger: Parsing 'RRULE:FREQ=HOURLY;INTERVAL=0' — u32 parse succeeds with value 0 and the explicit zero check bails.

Common situations: Config templating that substitutes an unset variable as 0; user thinking INTERVAL=0 means 'every hour'.

Understand the failure class

Background: "value must be between 0 and 1" / "out of range" / "must not be negative" errors: fixing range-validation failures across open-source libraries — this error's family across 42 libraries.

Related errors


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

Appendix: source

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

                    if key != "FREQ"
                        && key != "INTERVAL"
                        && key != "BYDAY"
                        && key != "BYHOUR"
                        && key != "BYMINUTE"
                    {
                        bail!(
                            "Unsupported RRULE field '{key}' for HOURLY. Allowed: FREQ,INTERVAL,BYDAY,BYHOUR,BYMINUTE"
                        );
                    }
                }
                let interval_hours = parts
                    .get("INTERVAL")
                    .map(|v| v.parse::<u32>())
                    .transpose()
                    .context("Failed to parse INTERVAL")?
                    .unwrap_or(1);
                if interval_hours == 0 {
                    bail!("INTERVAL must be >= 1 for HOURLY schedules");
                }
                let byday = parts
                    .get("BYDAY")
                    .map(|value| parse_byday(&value.to_ascii_uppercase()))
                    .transpose()?;
                let anchor_hour = parts
                    .get("BYHOUR")
                    .map(|value| value.parse::<u32>())
                    .transpose()
                    .context("Failed to parse BYHOUR")?;
                let anchor_minute = parts
                    .get("BYMINUTE")
                    .map(|value| value.parse::<u32>())
                    .transpose()
                    .context("Failed to parse BYMINUTE")?;
                if anchor_hour.is_some_and(|hour| hour > 23) {
                    bail!("BYHOUR must be between 0 and 23");
                }

View on GitHub (pinned to 73e0f67d83)