Hmbown/CodeWhale · error · anyhow::Error

Unsupported RRULE field

Error message

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

What it means

For FREQ=WEEKLY, the parser whitelists only FREQ, BYDAY, BYHOUR, and BYMINUTE. INTERVAL is deliberately not allowed for weekly schedules, and any other key triggers rejection instead of silent ignoring.

Solutions

  1. Remove unsupported keys (including INTERVAL) from the WEEKLY rule
  2. Encode 'every N weeks' differently, e.g. with CRON frequency
  3. Fix key typos to exactly FREQ, BYDAY, BYHOUR, or BYMINUTE

Example fix

// before
RRULE:FREQ=WEEKLY;INTERVAL=2;BYDAY=MO;BYHOUR=9;BYMINUTE=0
// after
RRULE:FREQ=WEEKLY;BYDAY=MO;BYHOUR=9;BYMINUTE=0
Defensive patterns

Strategy: validation

Validate before calling

const ALLOWED = ["FREQ","BYDAY","BYHOUR","BYMINUTE"];
for (const kv of rule.split(';').slice(1)) {
  const key = kv.split('=')[0].trim().toUpperCase();
  if (!ALLOWED.includes(key)) throw new Error(`Unsupported RRULE field ${key} for WEEKLY`);
}

Try / catch

try {
  parse_rrule(rule)?;
} catch e if e.to_string().contains("Unsupported RRULE field") && e.to_string().contains("WEEKLY") {
  eprintln!("{e}: remove INTERVAL/COUNT etc. from WEEKLY rules");
}

Prevention

When it happens

Trigger: Parsing 'RRULE:FREQ=WEEKLY;INTERVAL=2;BYDAY=MO' or 'RRULE:FREQ=WEEKLY;BYDAY=MO;COUNT=4'.

Common situations: Copying RFC-5545 weekly rules that use INTERVAL or COUNT; assuming HOURLY's key set applies to WEEKLY too.

Related errors


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

Appendix: source

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

                    .transpose()
                    .context("Failed to parse BYMINUTE")?;
                if anchor_hour.is_some_and(|hour| hour > 23) {
                    bail!("BYHOUR must be between 0 and 23");
                }
                if anchor_minute.is_some_and(|minute| minute > 59) {
                    bail!("BYMINUTE must be between 0 and 59");
                }
                Ok(Self::Hourly {
                    interval_hours,
                    byday,
                    anchor_hour,
                    anchor_minute,
                })
            }
            AutomationFrequency::Weekly => {
                for key in parts.keys() {
                    if key != "FREQ" && key != "BYDAY" && key != "BYHOUR" && key != "BYMINUTE" {
                        bail!(
                            "Unsupported RRULE field '{key}' for WEEKLY. Allowed: FREQ,BYDAY,BYHOUR,BYMINUTE"
                        );
                    }
                }
                let byday_raw = parts
                    .get("BYDAY")
                    .ok_or_else(|| anyhow::anyhow!("WEEKLY schedules require BYDAY"))?;
                let byday = parse_byday(&byday_raw.to_ascii_uppercase())?;
                if byday.is_empty() {
                    bail!("BYDAY cannot be empty for WEEKLY schedules");
                }
                let byhour = parts
                    .get("BYHOUR")
                    .ok_or_else(|| anyhow::anyhow!("WEEKLY schedules require BYHOUR"))?
                    .parse::<u32>()
                    .context("Failed to parse BYHOUR")?;
                let byminute = parts
                    .get("BYMINUTE")

View on GitHub (pinned to 73e0f67d83)