{"record":{"id":"4e85b66b7a7c3653","repo":"Hmbown/CodeWhale","slug":"failed-to-parse-once-at-trimmed-use-local-yyy","errorCode":null,"errorMessage":"Failed to parse ONCE AT '{trimmed}'. Use local YYYY-MM-DDTHH:MM[:SS] or RFC3339","messagePattern":"Failed to parse ONCE AT '(.+?)'\\. Use local YYYY-MM-DDTHH:MM\\[:SS\\] or RFC3339","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/tui/src/automation_manager.rs","lineNumber":738,"sourceCode":"        .filter(|value| !value.is_empty())\n        .ok_or_else(|| anyhow::anyhow!(\"CRON schedules require EXPR\"))?;\n    ParsedCronExpr::parse(&expr)?;\n    Ok(AutomationSchedule::Cron { expr })\n}\n\nfn parse_once_at(raw: &str) -> Result<DateTime<Utc>> {\n    let trimmed = raw.trim();\n    if let Ok(at) = DateTime::parse_from_rfc3339(trimmed) {\n        return Ok(at.with_timezone(&Utc));\n    }\n    for format in [\"%Y-%m-%dT%H:%M:%S\", \"%Y-%m-%dT%H:%M\"] {\n        if let Ok(naive) = NaiveDateTime::parse_from_str(trimmed, format) {\n            return resolve_local_datetime(&Local, naive)\n                .map(|value| value.with_timezone(&Utc))\n                .ok_or_else(|| anyhow::anyhow!(\"ONCE local time does not exist: {trimmed}\"));\n        }\n    }\n    bail!(\"Failed to parse ONCE AT '{trimmed}'. Use local YYYY-MM-DDTHH:MM[:SS] or RFC3339\")\n}\n\n#[derive(Debug, Clone)]\nstruct ParsedCronExpr {\n    minute: CronField,\n    hour: CronField,\n    day_of_month: CronField,\n    month: CronField,\n    day_of_week: CronField,\n}\n\nimpl ParsedCronExpr {\n    fn parse(expr: &str) -> Result<Self> {\n        let fields: Vec<&str> = expr.split_whitespace().collect();\n        if fields.len() != 5 {\n            bail!(\n                \"CRON EXPR must have exactly 5 fields: minute hour day-of-month month day-of-week\"\n            );","sourceCodeStart":720,"sourceCodeEnd":756,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/automation_manager.rs#L720-L756","documentation":"parse_once_at accepts either an RFC3339 timestamp or a local NaiveDateTime in YYYY-MM-DDTHH:MM[:SS] form. If the trimmed string matches neither RFC3339 nor either local format, it bails with this message echoing the input and the expected shapes. This is parse-level rejection at schedule creation, distinct from the 'does not exist' error for DST-gap times that did parse.","triggerScenarios":"AutomationSchedule::parse with FREQ=ONCE;AT=<value> where the value is not RFC3339 and not YYYY-MM-DDTHH:MM or YYYY-MM-DDTHH:MM[:SS] — e.g. 'tomorrow 9am', '2026/09/21 09:00', epoch seconds, or a missing date part.","commonSituations":"Users typing human-friendly times ('9am tomorrow'); using slashes or a space instead of 'T'; omitting the date; locale-formatted dates.","solutions":["Supply the time as YYYY-MM-DDTHH:MM or YYYY-MM-DDTHH:MM:SS (local time), e.g. 2026-09-21T09:00.","Or use a full RFC3339 timestamp with offset, e.g. 2026-09-21T09:00:00Z or 2026-09-21T09:00:00+02:00.","Use 'T' (not a space or slash) between date and time, and a 4-digit year with 2-digit month/day."],"exampleFix":"// before\nFREQ=ONCE;AT=tomorrow 9am\n// after\nFREQ=ONCE;AT=2026-09-22T09:00","handlingStrategy":"validation","validationCode":"fn valid_once_at(s: &str) -> bool {\n    let t = s.trim();\n    chrono::DateTime::parse_from_rfc3339(t).is_ok()\n        || chrono::NaiveDateTime::parse_from_str(t, \"%Y-%m-%dT%H:%M:%S\").is_ok()\n        || chrono::NaiveDateTime::parse_from_str(t, \"%Y-%m-%dT%H:%M\").is_ok()\n}","typeGuard":null,"tryCatchPattern":"match AutomationSchedule::parse(rrule) {\n    Ok(s) => save(s),\n    Err(e) if e.to_string().contains(\"Failed to parse ONCE AT\") => show_format_help(&e),\n    Err(e) => report(e),\n}","preventionTips":["Use a date-time picker widget instead of free-text input for AT.","Show the accepted formats (local YYYY-MM-DDTHH:MM[:SS] or RFC3339) next to the field.","Prefer emitting RFC3339 with an explicit offset to avoid local-timezone ambiguity."],"tags":["validation","date-time","parsing"],"backgroundTag":"invalid-date-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"}