Hmbown/CodeWhale · error · anyhow::Error
RRULE must include FREQ
Error message
RRULE must include FREQ
What it means
The RRULE string parsed by automation_manager must contain a FREQ key; when the RRULE parameter map has no FREQ entry the parser bails before frequency dispatch. FREQ is the mandatory discriminator for the whole schedule grammar.
Solutions
- Add a FREQ parameter (ONCE, HOURLY, WEEKLY, or CRON) to the RRULE string
- Verify the stored automation schedule was not truncated when written
- Validate the RRULE before saving it into automation config
Example fix
// before let rule = "RRULE:BYHOUR=9;BYMINUTE=30"; // after let rule = "RRULE:FREQ=WEEKLY;BYDAY=MO;BYHOUR=9;BYMINUTE=30";
Defensive patterns
Strategy: validation
Validate before calling
if (!/(^|;)\s*FREQ=/.test(rule)) throw new Error("RRULE must include FREQ=ONCE|HOURLY|WEEKLY|CRON"); Type guard
function hasFreq(rule: string): boolean {
return rule.split(';').some(p => p.trim().toUpperCase().startsWith('FREQ='));
} Try / catch
match parse_rrule(rule) {
Err(e) if e.to_string() == "RRULE must include FREQ" => eprintln!("Add FREQ=<ONCE|HOURLY|WEEKLY|CRON> to the rule"),
other => other?,
} Prevention
- Always generate RRULE strings through a builder that emits FREQ first
- Round-trip test stored schedules by parsing them at write time
- Never hand-edit automation config without re-validating
When it happens
Trigger: Calling the schedule parser with an RRULE like 'RRULE:BYHOUR=9' or an empty/blank RRULE parameter section so parts.get("FREQ") returns None.
Common situations: Truncated config strings after manual editing; RRULEs copied without the FREQ clause; automation definitions saved by older tooling with a different grammar.
Understand the failure class
Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.
Related errors
- BYDAY cannot be empty for WEEKLY schedules
- BYHOUR must be between 0 and 23
- BYMINUTE must be between 0 and 59
- INTERVAL must be >= 1 for HOURLY schedules
- Invalid BYDAY value
AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22).
Data as JSON: /api/errors/7e3ab12928db3d6f.
Report an issue: GitHub.
Appendix: source
Thrown at crates/tui/src/automation_manager.rs:365
let Some((k, v)) = item.split_once('=') else {
bail!("Invalid RRULE segment '{item}'");
};
parts.insert(k.trim().to_ascii_uppercase(), v.trim().to_string());
}
let freq = match parts
.get("FREQ")
.map(|value| value.trim().to_ascii_uppercase())
.as_deref()
{
Some("ONCE") => return parse_once_schedule(&parts),
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")View on GitHub (pinned to 73e0f67d83)