{"record":{"id":"d1d5137c0eeecfd2","repo":"Hmbown/CodeWhale","slug":"interval-must-be-1-for-hourly-schedules","errorCode":null,"errorMessage":"INTERVAL must be >= 1 for HOURLY schedules","messagePattern":"INTERVAL must be >= 1 for HOURLY schedules","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/tui/src/automation_manager.rs","lineNumber":334,"sourceCode":"                    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\")\n                    .map(|v| v.parse::<u32>())\n                    .transpose()\n                    .context(\"Failed to parse INTERVAL\")?\n                    .unwrap_or(1);\n                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                }","sourceCodeStart":316,"sourceCodeEnd":352,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/0c42157ee52f9d55af2b506d71b46249910f77d3/crates/tui/src/automation_manager.rs#L316-L352","documentation":"INTERVAL for HOURLY schedules parses as u32 and must be at least 1, because it is the number of hours between runs; 0 would mean an infinite loop of identical fire times. A missing INTERVAL defaults to 1, so only an explicit INTERVAL=0 reaches this check (negatives fail earlier as a u32 parse error under 'Failed to parse INTERVAL').","triggerScenarios":"parse_rrule(\"FREQ=HOURLY;INTERVAL=0\") or `INTERVAL=00` (both parse to 0).","commonSituations":"Computing INTERVAL from a variable that can be zero (e.g. `hours = user_input`); config templates defaulting empty numeric fields to 0.","solutions":["Set INTERVAL to the real spacing in hours, minimum 1 (`FREQ=HOURLY;INTERVAL=1` for hourly).","If sub-hourly firing was intended, use `FREQ=CRON;EXPR=...` (e.g. `*/15 * * * *`).","Clamp/validate computed intervals to >= 1 before building the RRULE string."],"exampleFix":"// before\nlet rrule = format!(\"FREQ=HOURLY;INTERVAL={interval}\"); // interval == 0 -> bails\n\n// after\nlet interval = interval.max(1);\nlet rrule = format!(\"FREQ=HOURLY;INTERVAL={interval}\");","handlingStrategy":"validation","validationCode":"let interval: u32 = interval_input.max(1); // clamp before formatting\nlet rrule = format!(\"FREQ=HOURLY;INTERVAL={interval}\");","typeGuard":"fn valid_hourly_interval(v: u32) -> bool { v >= 1 }","tryCatchPattern":"match AutomationSchedule::parse_rrule(&rrule) {\n    Ok(s) => s,\n    Err(e) if e.to_string().contains(\"INTERVAL must be >= 1\") => AutomationSchedule::parse_rrule(\"FREQ=HOURLY;INTERVAL=1\")?,\n    Err(e) => return Err(e),\n}","preventionTips":["Clamp computed intervals to >= 1 before building the rule string.","Use spin buttons / numeric inputs with min=1 in UIs for INTERVAL.","For sub-hourly cadence choose FREQ=CRON instead of INTERVAL=0."],"tags":["rrule","automation","schedule","interval"],"backgroundTag":"rrule-invalid-interval","analyzedSha":"0c42157ee52f9d55af2b506d71b46249910f77d3","analyzedAt":"2026-08-20T21:50:45.477Z","schemaVersion":2},"datasetVersion":"2026-08-22T04:17:13.399Z"}