Hmbown/CodeWhale · error · anyhow::Error

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

Error message

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

What it means

parse_once_schedule rejects any RRULE key other than FREQ and AT for FREQ=ONCE. Keys are uppercased before the check, so it is case-insensitive; only extraneous fields trigger this error (a missing AT produces 'ONCE schedules require AT' instead).

Source

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

            "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 0c42157ee5)

Solutions

  1. Strip all keys except FREQ and AT for one-shot schedules
  2. Express recurrence with FREQ=HOURLY, WEEKLY, or CRON instead of extra ONCE fields
  3. Keep the fire time solely in AT (RFC3339 or local naive format)
  4. Dry-run parse_rrule on the final string before saving

Example fix

// before
rrule = "FREQ=ONCE;AT=2026-08-03T14:30;INTERVAL=1"

// after
rrule = "FREQ=ONCE;AT=2026-08-03T14:30"
Defensive patterns

Strategy: validation

Validate before calling

fn valid_once_rrule(rrule: &str) -> bool {
    rrule.split(';')
        .filter_map(|s| s.split_once('=').map(|(k, _)| k.trim().to_ascii_uppercase()))
        .all(|k| k == "FREQ" || k == "AT")
}

Prevention

When it happens

Trigger: AutomationSchedule::parse_rrule("FREQ=ONCE;AT=2026-08-03T14:30;BYDAY=MO"), or FREQ=ONCE;INTERVAL=2;AT=... — any key beyond FREQ/AT.

Common situations: Converting a recurring rrule to ONCE and leaving INTERVAL/BYDAY behind; pasting full iCalendar RRULEs containing COUNT, UNTIL, or DTSTART.

Related errors


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