Hmbown/CodeWhale · error · anyhow::Error

Unsupported RRULE field

Error message

Unsupported RRULE field '{key}' for ONCE. Allowed: FREQ,AT

What it means

parse_once_schedule whitelists the RRULE keys allowed for a ONCE schedule: only FREQ and AT. Any other key in the parsed key/value parts bails with this message listing the allowed set. It exists so users get a precise rejection instead of a silently ignored field (e.g. BYDAY on a one-shot schedule would be meaningless).

Solutions

  1. Remove all fields except FREQ and AT from the ONCE RRULE.
  2. Move recurring-only fields (INTERVAL, BYDAY, BYHOUR, BYMINUTE) to a HOURLY/WEEKLY schedule instead.
  3. Use FREQ=CRON with EXPR if you need richer recurrence semantics.

Example fix

// before
FREQ=ONCE;AT=2026-09-21T09:00;BYDAY=MO
// after
FREQ=ONCE;AT=2026-09-21T09:00
Defensive patterns

Strategy: validation

Validate before calling

const ONCE_KEYS: [&str; 2] = ["FREQ", "AT"];
if !parts.keys().all(|k| ONCE_KEYS.contains(&k.as_str())) {
    return Err("ONCE schedules allow only FREQ and AT");
}

Try / catch

match AutomationSchedule::parse(rrule) {
    Ok(s) => save(s),
    Err(e) if e.to_string().contains("for ONCE") => strip_unknown_fields_and_retry(),
    Err(e) => report(e),
}

Prevention

When it happens

Trigger: AutomationSchedule::parse with FREQ=ONCE plus any key besides AT — e.g. BYDAY, BYHOUR, INTERVAL, or EXPR included in the RRULE string.

Common situations: Copying an RRULE from a recurring schedule and changing only FREQ to ONCE while leaving INTERVAL/BYDAY behind; pasting a full iCalendar RRULE with extra fields.

Related errors


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

Appendix: source

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

            "TU" => Weekday::Tue,
            "WE" => Weekday::Wed,
            "TH" => Weekday::Thu,
            "FR" => Weekday::Fri,
            "SA" => Weekday::Sat,
            "SU" => Weekday::Sun,
            other => bail!("Invalid BYDAY value '{other}'"),
        };
        if !days.contains(&day) {
            days.push(day);
        }
    }
    Ok(days)
}

fn parse_once_schedule(parts: &BTreeMap<String, String>) -> Result<AutomationSchedule> {
    for key in parts.keys() {
        if key != "FREQ" && key != "AT" {
            bail!("Unsupported RRULE field '{key}' for ONCE. Allowed: FREQ,AT");
        }
    }
    let raw_at = parts
        .get("AT")
        .ok_or_else(|| anyhow::anyhow!("ONCE schedules require AT"))?;
    let at = parse_once_at(raw_at)?;
    Ok(AutomationSchedule::Once { at })
}

fn parse_cron_schedule(parts: &BTreeMap<String, String>) -> Result<AutomationSchedule> {
    for key in parts.keys() {
        if key != "FREQ" && key != "EXPR" {
            bail!("Unsupported RRULE field '{key}' for CRON. Allowed: FREQ,EXPR");
        }
    }
    let expr = parts
        .get("EXPR")
        .map(|value| value.trim().to_string())

View on GitHub (pinned to 73e0f67d83)