{"record":{"id":"7a18864423dd4592","repo":"Hmbown/CodeWhale","slug":"byminute-must-be-between-0-and-59","errorCode":null,"errorMessage":"BYMINUTE must be between 0 and 59","messagePattern":"BYMINUTE must be between 0 and 59","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/tui/src/automation_manager.rs","lineNumber":354,"sourceCode":"                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                    }\n                }\n                let byday_raw = parts\n                    .get(\"BYDAY\")","sourceCodeStart":336,"sourceCodeEnd":372,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/0c42157ee52f9d55af2b506d71b46249910f77d3/crates/tui/src/automation_manager.rs#L336-L372","documentation":"In the HOURLY branch, an optional BYMINUTE anchor must be a valid minute 0–59 (u32, so 60+ fails this check). Like BYHOUR, it pins the initial local wall-clock minute of the anchored cadence and has no meaning outside the valid minute range.","triggerScenarios":"parse_rrule(\"FREQ=HOURLY;BYMINUTE=60\") or BYMINUTE=90/999 in a HOURLY rule.","commonSituations":"Using 60 for 'top of the next hour'; leap-second-style values like 60; copy-paste of seconds into the minute field.","solutions":["Use a minute 0–59 (`BYMINUTE=0` for the top of the hour).","Validate the numeric range in the form/config layer before constructing the RRULE.","For second-level precision use `FREQ=CRON;EXPR=... ` — note cron here still fires at minute granularity, so express minute-level needs as-is."],"exampleFix":"// before\nlet s = AutomationSchedule::parse_rrule(\"FREQ=HOURLY;BYMINUTE=60\")?; // bails: 0-59\n\n// after\nlet s = AutomationSchedule::parse_rrule(\"FREQ=HOURLY;BYMINUTE=0\")?;","handlingStrategy":"validation","validationCode":"let minute: u32 = minute_input;\nassert!(minute <= 59, \"BYMINUTE must be 0-59\");\nlet rrule = format!(\"FREQ=HOURLY;BYMINUTE={minute}\");","typeGuard":"fn valid_minute(m: u32) -> bool { m <= 59 }","tryCatchPattern":"match AutomationSchedule::parse_rrule(&rrule) {\n    Ok(s) => s,\n    Err(e) if e.to_string().starts_with(\"BYMINUTE must be between 0 and 59\") => { /* re-prompt for a 0-59 minute */ return Err(e) }\n    Err(e) => return Err(e),\n}","preventionTips":["Minutes run 0–59; 60 means 'next hour, minute 0'.","Never paste seconds into the minute field.","Range-check numeric fields before serializing the RRULE."],"tags":["rrule","automation","schedule","minute-range"],"backgroundTag":"rrule-minute-out-of-range","analyzedSha":"0c42157ee52f9d55af2b506d71b46249910f77d3","analyzedAt":"2026-08-20T21:50:45.477Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}