Hmbown/CodeWhale · error · anyhow::Error

Unsupported RRULE field '{key}' for HOURLY. Allowed: FREQ,IN

Error message

Unsupported RRULE field '{key}' for HOURLY. Allowed: FREQ,INTERVAL,BYDAY,BYHOUR,BYMINUTE

What it means

For FREQ=HOURLY the parser whitelists exactly FREQ, INTERVAL, BYDAY, BYHOUR, BYMINUTE. Any other key in the map — UNTIL, COUNT, BYMONTH, DTSTART, or even fields legal for other variants like CRON's EXPR — is rejected so unsupported semantics cannot be silently dropped.

Source

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

            Some("HOURLY") => AutomationFrequency::Hourly,
            Some("WEEKLY") => AutomationFrequency::Weekly,
            Some("CRON") => return parse_cron_schedule(&parts),
            Some(other) => {
                bail!("Unsupported RRULE FREQ '{other}'. Supported: ONCE, HOURLY, WEEKLY, and CRON")
            }
            None => bail!("RRULE must include FREQ"),
        };

        match freq {
            AutomationFrequency::Hourly => {
                for key in parts.keys() {
                    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

View on GitHub (pinned to 0c42157ee5)

Solutions

  1. Strip the unsupported key(s); for a bounded run, enforce the end condition in your own scheduler loop, not in the RRULE.
  2. Replace complex rules with `FREQ=CRON;EXPR=...` when cron can express them.
  3. Keep HOURLY rules to the five allowed keys: FREQ,INTERVAL,BYDAY,BYHOUR,BYMINUTE.

Example fix

// before
let s = AutomationSchedule::parse_rrule("FREQ=HOURLY;INTERVAL=2;UNTIL=20261231T000000Z")?; // bails on UNTIL

// after
let s = AutomationSchedule::parse_rrule("FREQ=HOURLY;INTERVAL=2")?; // enforce UNTIL in your loop
Defensive patterns

Strategy: validation

Validate before calling

const HOURLY_ALLOWED: &[&str] = &["FREQ", "INTERVAL", "BYDAY", "BYHOUR", "BYMINUTE"];
for key in rrule.split(';').filter_map(|p| p.trim().split_once('=')) {
    let k = key.0.trim().to_ascii_uppercase();
    if !HOURLY_ALLOWED.contains(&k.as_str()) {
        anyhow::bail!("{k} is not allowed for FREQ=HOURLY");
    }
}

Type guard

fn hourly_keys_allowed(rrule: &str) -> bool {
    rrule.split(';').filter_map(|p| p.trim().split_once('=')).all(|(k, _)| {
        ["FREQ", "INTERVAL", "BYDAY", "BYHOUR", "BYMINUTE"].contains(&k.trim().to_ascii_uppercase().as_str())
    })
}

Try / catch

match AutomationSchedule::parse_rrule(&rrule) {
    Ok(s) => s,
    Err(e) if e.to_string().contains("for HOURLY") => { /* strip unsupported key or use CRON */ return Err(e) }
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: parse_rrule("FREQ=HOURLY;INTERVAL=2;UNTIL=20261231T000000Z") or `FREQ=HOURLY;COUNT=5`, or mixing variants like `FREQ=HOURLY;EXPR=*/5 * * * *`.

Common situations: Copying a full RFC 5545 rule that carries UNTIL/COUNT/BYMONTH; incrementally adding fields to a working HOURLY rule without checking the whitelist.

Related errors


AI-assisted analysis of Hmbown/CodeWhale@0c42157ee5 (2026-08-20). Data as JSON: /api/errors/27acee85a982526e. Report an issue: GitHub.