{"record":{"id":"7e3ab12928db3d6f","repo":"Hmbown/CodeWhale","slug":"rrule-must-include-freq","errorCode":null,"errorMessage":"RRULE must include FREQ","messagePattern":"RRULE must include FREQ","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/tui/src/automation_manager.rs","lineNumber":365,"sourceCode":"            let Some((k, v)) = item.split_once('=') else {\n                bail!(\"Invalid RRULE segment '{item}'\");\n            };\n            parts.insert(k.trim().to_ascii_uppercase(), v.trim().to_string());\n        }\n\n        let freq = match parts\n            .get(\"FREQ\")\n            .map(|value| value.trim().to_ascii_uppercase())\n            .as_deref()\n        {\n            Some(\"ONCE\") => return parse_once_schedule(&parts),\n            Some(\"HOURLY\") => AutomationFrequency::Hourly,\n            Some(\"WEEKLY\") => AutomationFrequency::Weekly,\n            Some(\"CRON\") => return parse_cron_schedule(&parts),\n            Some(other) => {\n                bail!(\"Unsupported RRULE FREQ '{other}'. Supported: ONCE, HOURLY, WEEKLY, and CRON\")\n            }\n            None => bail!(\"RRULE must include FREQ\"),\n        };\n\n        match freq {\n            AutomationFrequency::Hourly => {\n                for key in parts.keys() {\n                    if key != \"FREQ\"\n                        && key != \"INTERVAL\"\n                        && key != \"BYDAY\"\n                        && key != \"BYHOUR\"\n                        && key != \"BYMINUTE\"\n                    {\n                        bail!(\n                            \"Unsupported RRULE field '{key}' for HOURLY. Allowed: FREQ,INTERVAL,BYDAY,BYHOUR,BYMINUTE\"\n                        );\n                    }\n                }\n                let interval_hours = parts\n                    .get(\"INTERVAL\")","sourceCodeStart":347,"sourceCodeEnd":383,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/automation_manager.rs#L347-L383","documentation":"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.","triggerScenarios":"Calling the schedule parser with an RRULE like 'RRULE:BYHOUR=9' or an empty/blank RRULE parameter section so parts.get(\"FREQ\") returns None.","commonSituations":"Truncated config strings after manual editing; RRULEs copied without the FREQ clause; automation definitions saved by older tooling with a different 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"],"exampleFix":"// before\nlet rule = \"RRULE:BYHOUR=9;BYMINUTE=30\";\n// after\nlet rule = \"RRULE:FREQ=WEEKLY;BYDAY=MO;BYHOUR=9;BYMINUTE=30\";","handlingStrategy":"validation","validationCode":"if (!/(^|;)\\s*FREQ=/.test(rule)) throw new Error(\"RRULE must include FREQ=ONCE|HOURLY|WEEKLY|CRON\");","typeGuard":"function hasFreq(rule: string): boolean {\n  return rule.split(';').some(p => p.trim().toUpperCase().startsWith('FREQ='));\n}","tryCatchPattern":"match parse_rrule(rule) {\n  Err(e) if e.to_string() == \"RRULE must include FREQ\" => eprintln!(\"Add FREQ=<ONCE|HOURLY|WEEKLY|CRON> to the rule\"),\n  other => other?,\n}","preventionTips":["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"],"tags":["rrule","scheduling","missing-field"],"backgroundTag":"missing-required-config-field","analyzedSha":"73e0f67d83c59909b571efdfc88c4bc28c309cb1","analyzedAt":"2026-09-22T01:30:00.501Z","contentChangedAt":"2026-09-22T01:30:00.501Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}