{"record":{"id":"c980cc5fcaa88296","repo":"Hmbown/CodeWhale","slug":"invalid-rrule-segment-item","errorCode":null,"errorMessage":"Invalid RRULE segment '{item}'","messagePattern":"Invalid RRULE segment '(.+?)'","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/tui/src/automation_manager.rs","lineNumber":348,"sourceCode":"        byday: Vec<Weekday>,\n        byhour: u32,\n        byminute: u32,\n    },\n    Cron {\n        expr: String,\n    },\n}\n\nimpl AutomationSchedule {\n    pub fn parse_rrule(rrule: &str) -> Result<Self> {\n        let mut parts: BTreeMap<String, String> = BTreeMap::new();\n        for raw in rrule.split(';') {\n            let item = raw.trim();\n            if item.is_empty() {\n                continue;\n            }\n            let Some((k, v)) = item.split_once('=') else {\n                bail!(\"Invalid RRULE segment '{item}'\");\n            };\n            parts.insert(k.trim().to_ascii_uppercase(), v.trim().to_string());\n        }\n\n        let freq = match parts\n            .get(\"FREQ\")\n            .map(|value| value.trim().to_ascii_uppercase())\n            .as_deref()\n        {\n            Some(\"ONCE\") => return parse_once_schedule(&parts),\n            Some(\"HOURLY\") => AutomationFrequency::Hourly,\n            Some(\"WEEKLY\") => AutomationFrequency::Weekly,\n            Some(\"CRON\") => return parse_cron_schedule(&parts),\n            Some(other) => {\n                bail!(\"Unsupported RRULE FREQ '{other}'. Supported: ONCE, HOURLY, WEEKLY, and CRON\")\n            }\n            None => bail!(\"RRULE must include FREQ\"),\n        };","sourceCodeStart":330,"sourceCodeEnd":366,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/automation_manager.rs#L330-L366","documentation":"The automation manager parses RRULE strings (RFC 5545 recurrence rules) into key=value parts by splitting on ';' and then on '='. Any non-empty segment lacking an '=' — e.g. 'FREQ', 'DAILY;', or a stray token — is rejected with this error naming the offending segment.","triggerScenarios":"Creating/updating an automation whose rrule string contains a ';'-separated segment without a key=value form, like \"FREQ=DAILY;INTERVAL\" or trailing garbage \"FREQ=DAILY;;oops\".","commonSituations":"Hand-typed cron/RRULE strings in config; copying RRULE fragments from calendar apps that include options the parser doesn't split; whitespace mangled so the '=' was lost; pasting a human-readable description instead of an RRULE.","solutions":["Inspect the segment named in the message and ensure it has key=value form (e.g. INTERVAL=2).","Start from a minimal valid rule: FREQ=<DAILY|WEEKLY|MONTHLY> and add parts one at a time.","Trim whitespace and stray separators: \"FREQ=DAILY;INTERVAL=1;BYDAY=MO\".","Validate the RRULE with a parser or `rrule` tooling before saving it into config.","Check the automation's stored rrule in config/session files for corruption."],"exampleFix":"// before: malformed segment\nlet rule = \"FREQ=DAILY;INTERVAL\";\n// after: valid key=value segments\nlet rule = \"FREQ=DAILY;INTERVAL=1\";","handlingStrategy":"validation","validationCode":"fn rrule_segments_valid(rrule: &str) -> bool {\n    rrule.split(';')\n        .map(str::trim)\n        .filter(|s| !s.is_empty())\n        .all(|s| s.split_once('=').map_or(false, |(k, v)| !k.trim().is_empty() && !v.trim().is_empty()))\n}\n// ensure rrule_segments_valid(&rule) before saving","typeGuard":"fn is_valid_rrule(s: &str) -> bool { rrule_segments_valid(s) && s.contains(\"FREQ=\") }","tryCatchPattern":"match Automation::new(name, &rrule) {\n    Err(e) if e.to_string().contains(\"Invalid RRULE segment\") => {\n        eprintln!(\"Fix the RRULE: {e}. Example: FREQ=DAILY;INTERVAL=1\");\n        prompt_user_for_rrule()\n    }\n    r => r?,\n}","preventionTips":["Validate the RRULE string in UI/config before persisting it","Start from a known-good template like FREQ=WEEKLY;BYDAY=MO","Strip whitespace and empty segments before parsing","Show the offending segment back to the user in error messages"],"tags":["parsing","rrule","validation"],"backgroundTag":"invalid-argument-format","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"}