{"record":{"id":"8d54907536a866f3","repo":"Hmbown/CodeWhale","slug":"weekly-schedules-require-byday","errorCode":null,"errorMessage":"WEEKLY schedules require BYDAY","messagePattern":"WEEKLY schedules require BYDAY","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/automation_manager.rs","lineNumber":428,"sourceCode":"                }\n                Ok(Self::Hourly {\n                    interval_hours,\n                    byday,\n                    anchor_hour,\n                    anchor_minute,\n                })\n            }\n            AutomationFrequency::Weekly => {\n                for key in parts.keys() {\n                    if key != \"FREQ\" && key != \"BYDAY\" && key != \"BYHOUR\" && key != \"BYMINUTE\" {\n                        bail!(\n                            \"Unsupported RRULE field '{key}' for WEEKLY. Allowed: FREQ,BYDAY,BYHOUR,BYMINUTE\"\n                        );\n                    }\n                }\n                let byday_raw = parts\n                    .get(\"BYDAY\")\n                    .ok_or_else(|| anyhow::anyhow!(\"WEEKLY schedules require BYDAY\"))?;\n                let byday = parse_byday(&byday_raw.to_ascii_uppercase())?;\n                if byday.is_empty() {\n                    bail!(\"BYDAY cannot be empty for WEEKLY schedules\");\n                }\n                let byhour = parts\n                    .get(\"BYHOUR\")\n                    .ok_or_else(|| anyhow::anyhow!(\"WEEKLY schedules require BYHOUR\"))?\n                    .parse::<u32>()\n                    .context(\"Failed to parse BYHOUR\")?;\n                let byminute = parts\n                    .get(\"BYMINUTE\")\n                    .ok_or_else(|| anyhow::anyhow!(\"WEEKLY schedules require BYMINUTE\"))?\n                    .parse::<u32>()\n                    .context(\"Failed to parse BYMINUTE\")?;\n\n                if byhour > 23 {\n                    bail!(\"BYHOUR must be between 0 and 23\");\n                }","sourceCodeStart":410,"sourceCodeEnd":446,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/automation_manager.rs#L410-L446","documentation":"The automation RRULE parser enforces a restricted WEEKLY recurrence grammar: FREQ, BYDAY, BYHOUR, BYMINUTE. A WEEKLY rule without a BYDAY field cannot resolve which weekdays to fire on, so parsing fails with this error.","triggerScenarios":"Registering or updating an automation whose schedule is e.g. 'FREQ=WEEKLY;BYHOUR=9;BYMINUTE=0' with no BYDAY key, or using an unsupported field that caused BYDAY to be dropped.","commonSituations":"Config copied from a full iCalendar RRULE using INTERVAL/COUNT/WKST, hand-written schedule missing BYDAY, migration from a scheduler that implied daily recurrence without BYDAY.","solutions":["Add BYDAY to the RRULE, e.g. FREQ=WEEKLY;BYDAY=MO,WE;BYHOUR=9;BYMINUTE=0","Remove unsupported fields (INTERVAL, COUNT, WKST, UNTIL) — only FREQ,BYDAY,BYHOUR,BYMINUTE are allowed","Use FREQ=DAILY instead if the intent was every-day recurrence","Validate the RRULE string against the documented WEEKLY grammar before saving"],"exampleFix":"// before\n\"FREQ=WEEKLY;BYHOUR=9;BYMINUTE=30\"\n// after\n\"FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,FR;BYHOUR=9;BYMINUTE=30\"","handlingStrategy":"validation","validationCode":"fn validate_weekly_rrule(rule: &str) -> Result<(), String> {\n    let parts: HashMap<_,_> = rule.split(';').filter_map(|p| p.split_once('=')).collect();\n    if parts.get(\"FREQ\").map(String::as_str) != Some(\"WEEKLY\") { return Ok(()); }\n    if !parts.contains_key(\"BYDAY\") { return Err(\"WEEKLY schedules require BYDAY\".into()); }\n    Ok(())\n}","typeGuard":null,"tryCatchPattern":"match parse_rrule(&rule) {\n    Ok(schedule) => save(schedule),\n    Err(e) if e.to_string().contains(\"require BYDAY\") =>\n        eprintln!(\"Add BYDAY (e.g. BYDAY=MO,WE) to your WEEKLY rule\"),\n    Err(e) => return Err(e),\n}","preventionTips":["Always include BYDAY in WEEKLY rules","Build schedules via UI/CLI helpers that emit complete RRULEs","Strip unsupported iCal fields (INTERVAL, COUNT, WKST, UNTIL) before saving","Validate the full allowed field set: FREQ,BYDAY,BYHOUR,BYMINUTE"],"tags":["automation","rrule","scheduling","validation"],"backgroundTag":"missing-required-argument","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"}