Hmbown/CodeWhale · error

WEEKLY schedules require BYMINUTE

Error message

WEEKLY schedules require BYMINUTE

What it means

AutomationSchedule::parse_rrule requires WEEKLY schedules to pin the fire minute via BYMINUTE. This error fires after BYDAY and BYHOUR validated successfully but the BYMINUTE key is missing; WEEKLY has no default minute, so the schedule is rejected at parse time.

Source

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

                            "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")
                    .ok_or_else(|| anyhow::anyhow!("WEEKLY schedules require BYMINUTE"))?
                    .parse::<u32>()
                    .context("Failed to parse BYMINUTE")?;

                if byhour > 23 {
                    bail!("BYHOUR must be between 0 and 23");
                }
                if byminute > 59 {
                    bail!("BYMINUTE must be between 0 and 59");
                }

                Ok(Self::Weekly {
                    byday,
                    byhour,
                    byminute,
                })
            }
        }
    }

View on GitHub (pinned to 8880682c63)

Solutions

  1. Add BYMINUTE as 0-59: FREQ=WEEKLY;BYDAY=MO,WE;BYHOUR=9;BYMINUTE=30
  2. Values outside 0-59 are rejected separately with 'BYMINUTE must be between 0 and 59'
  3. Run parse_rrule on the finished string before saving or submitting

Example fix

// before
let rrule = "FREQ=WEEKLY;BYDAY=MO,WE;BYHOUR=9";
// after
let rrule = "FREQ=WEEKLY;BYDAY=MO,WE;BYHOUR=9;BYMINUTE=30";
Defensive patterns

Strategy: validation

Validate before calling

let parts: std::collections::BTreeMap<&str, &str> = rrule
    .split(';')
    .filter_map(|kv| kv.split_once('='))
    .collect();
if parts.get("FREQ").copied() == Some("WEEKLY") {
    let byminute = parts.get("BYMINUTE").context("WEEKLY requires BYMINUTE")?;
    let minute: u32 = byminute.parse().context("BYMINUTE must be numeric")?;
    ensure!(minute <= 59, "BYMINUTE must be 0-59");
}

Type guard

fn weekly_rrule_has_valid_byminute(rrule: &str) -> bool {
    rrule.split(';').any(|kv| {
        let (k, v) = kv.split_once('=').unwrap_or(("", ""));
        k.eq_ignore_ascii_case("FREQ") && v.eq_ignore_ascii_case("WEEKLY")
    }) && rrule
        .split(';')
        .find_map(|kv| kv.split_once('=').filter(|(k, _)| k == "BYMINUTE").map(|(_, v)| v))
        .and_then(|v| v.parse::<u32>().ok())
        .is_some_and(|m| m <= 59)
}

Prevention

When it happens

Trigger: An automation rrule like 'FREQ=WEEKLY;BYDAY=MO;BYHOUR=9' (BYMINUTE omitted) passed to AutomationSchedule::parse_rrule via automation create/update or the runtime API.

Common situations: Hand-truncated weekly RRULEs; editors dropping the last field; templates that treat BYMINUTE as optional the way HOURLY does.

Related errors


AI-assisted analysis of Hmbown/CodeWhale@8880682c63 (2026-08-16). Data as JSON: /api/errors/9fe00bfc03853f5a. Report an issue: GitHub.