{"record":{"id":"5ab5da019b8ab3fd","repo":"Hmbown/CodeWhale","slug":"byhour-must-be-between-0-and-23","errorCode":null,"errorMessage":"BYHOUR must be between 0 and 23","messagePattern":"BYHOUR must be between 0 and 23","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/tui/src/automation_manager.rs","lineNumber":406,"sourceCode":"                if interval_hours == 0 {\n                    bail!(\"INTERVAL must be >= 1 for HOURLY schedules\");\n                }\n                let byday = parts\n                    .get(\"BYDAY\")\n                    .map(|value| parse_byday(&value.to_ascii_uppercase()))\n                    .transpose()?;\n                let anchor_hour = parts\n                    .get(\"BYHOUR\")\n                    .map(|value| value.parse::<u32>())\n                    .transpose()\n                    .context(\"Failed to parse BYHOUR\")?;\n                let anchor_minute = parts\n                    .get(\"BYMINUTE\")\n                    .map(|value| value.parse::<u32>())\n                    .transpose()\n                    .context(\"Failed to parse BYMINUTE\")?;\n                if anchor_hour.is_some_and(|hour| hour > 23) {\n                    bail!(\"BYHOUR must be between 0 and 23\");\n                }\n                if anchor_minute.is_some_and(|minute| minute > 59) {\n                    bail!(\"BYMINUTE must be between 0 and 59\");\n                }\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                    }","sourceCodeStart":388,"sourceCodeEnd":424,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/automation_manager.rs#L388-L424","documentation":"RRULE validation for HOURLY automations: the BYHOUR part must denote a valid hour of day; a parsed value outside 0..23 is rejected before the schedule is stored, since no wall-clock hour could match it.","triggerScenarios":"Parsing 'RRULE:FREQ=HOURLY;BYHOUR=24' or 'BYHOUR=99' — parse succeeds, range check fails.","commonSituations":"Off-by-one 24:00 time notation; user entering military-time 24 for midnight instead of 0.","solutions":["Use BYHOUR between 0 and 23 (midnight is 0, not 24)","Clamp/normalize the hour value in the UI or config writer before saving","Omit BYHOUR if no specific anchor hour is needed"],"exampleFix":"// before\nRRULE:FREQ=HOURLY;INTERVAL=4;BYHOUR=24\n// after\nRRULE:FREQ=HOURLY;INTERVAL=4;BYHOUR=0","handlingStrategy":"validation","validationCode":"const m = rule.match(/BYHOUR=(\\d+)/);\nif (m && Number(m[1]) > 23) throw new Error(\"BYHOUR must be between 0 and 23\");","typeGuard":"function isValidHour(h: number): boolean { return Number.isInteger(h) && h >= 0 && h <= 23; }","tryCatchPattern":"try {\n  parse_rrule(rule)?;\n} catch e if e.to_string().contains(\"BYHOUR must be between 0 and 23\") {\n  eprintln!(\"{e}; use 0-23 (midnight = 0)\");\n}","preventionTips":["Constrain hour inputs to 0-23 in the UI","Convert 24:00-style input to 0 before serializing","After timezone shifts, normalize hours with modulo 24"],"tags":["rrule","scheduling","range-check","time"],"backgroundTag":"value-out-of-range","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"}