{"record":{"id":"9fe00bfc03853f5a","repo":"Hmbown/CodeWhale","slug":"weekly-schedules-require-byminute","errorCode":null,"errorMessage":"WEEKLY schedules require BYMINUTE","messagePattern":"WEEKLY schedules require BYMINUTE","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/automation_manager.rs","lineNumber":380,"sourceCode":"                            \"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                }\n                if byminute > 59 {\n                    bail!(\"BYMINUTE must be between 0 and 59\");\n                }\n\n                Ok(Self::Weekly {\n                    byday,\n                    byhour,\n                    byminute,\n                })\n            }\n        }\n    }","sourceCodeStart":362,"sourceCodeEnd":398,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/8880682c63083a91624de936797efa3ce9e498fd/crates/tui/src/automation_manager.rs#L362-L398","documentation":"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.","triggerScenarios":"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.","commonSituations":"Hand-truncated weekly RRULEs; editors dropping the last field; templates that treat BYMINUTE as optional the way HOURLY does.","solutions":["Add BYMINUTE as 0-59: FREQ=WEEKLY;BYDAY=MO,WE;BYHOUR=9;BYMINUTE=30","Values outside 0-59 are rejected separately with 'BYMINUTE must be between 0 and 59'","Run parse_rrule on the finished string before saving or submitting"],"exampleFix":"// before\nlet rrule = \"FREQ=WEEKLY;BYDAY=MO,WE;BYHOUR=9\";\n// after\nlet rrule = \"FREQ=WEEKLY;BYDAY=MO,WE;BYHOUR=9;BYMINUTE=30\";","handlingStrategy":"validation","validationCode":"let parts: std::collections::BTreeMap<&str, &str> = rrule\n    .split(';')\n    .filter_map(|kv| kv.split_once('='))\n    .collect();\nif parts.get(\"FREQ\").copied() == Some(\"WEEKLY\") {\n    let byminute = parts.get(\"BYMINUTE\").context(\"WEEKLY requires BYMINUTE\")?;\n    let minute: u32 = byminute.parse().context(\"BYMINUTE must be numeric\")?;\n    ensure!(minute <= 59, \"BYMINUTE must be 0-59\");\n}","typeGuard":"fn weekly_rrule_has_valid_byminute(rrule: &str) -> bool {\n    rrule.split(';').any(|kv| {\n        let (k, v) = kv.split_once('=').unwrap_or((\"\", \"\"));\n        k.eq_ignore_ascii_case(\"FREQ\") && v.eq_ignore_ascii_case(\"WEEKLY\")\n    }) && rrule\n        .split(';')\n        .find_map(|kv| kv.split_once('=').filter(|(k, _)| k == \"BYMINUTE\").map(|(_, v)| v))\n        .and_then(|v| v.parse::<u32>().ok())\n        .is_some_and(|m| m <= 59)\n}","tryCatchPattern":null,"preventionTips":["Treat BYMINUTE as a required field in every weekly RRULE you generate","Validate numeric range 0-59 up front to get precise errors instead of parse-time bails","Prefer generating RRULEs from a typed config object over string concatenation","Round-trip test: build, parse_rrule, and confirm fields survive"],"tags":["automation","rrule","scheduling","validation"],"backgroundTag":null,"analyzedSha":"8880682c63083a91624de936797efa3ce9e498fd","analyzedAt":"2026-08-16T11:31:27.956Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}