{"record":{"id":"3ce1f8f3578f4f47","repo":"Hmbown/CodeWhale","slug":"once-schedule-has-no-future-run-after","errorCode":null,"errorMessage":"Once schedule has no future run after {}","messagePattern":"Once schedule has no future run after (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/tui/src/automation_manager.rs","lineNumber":480,"sourceCode":"        after: DateTime<Utc>,\n        anchor_reference: DateTime<Utc>,\n    ) -> Result<DateTime<Utc>> {\n        self.next_after_in_timezone(after, anchor_reference, &Local)\n    }\n\n    fn next_after_in_timezone<Tz: TimeZone>(\n        &self,\n        after: DateTime<Utc>,\n        anchor_reference: DateTime<Utc>,\n        timezone: &Tz,\n    ) -> Result<DateTime<Utc>> {\n        let local_after = after.with_timezone(timezone);\n        match self {\n            Self::Once { at } => {\n                if *at > after {\n                    Ok(*at)\n                } else {\n                    bail!(\n                        \"Once schedule has no future run after {}\",\n                        after.to_rfc3339()\n                    )\n                }\n            }\n            Self::Hourly {\n                interval_hours,\n                byday,\n                anchor_hour,\n                anchor_minute,\n            } => {\n                if anchor_hour.is_some() || anchor_minute.is_some() {\n                    let local_anchor_reference = anchor_reference.with_timezone(timezone);\n                    let hour = anchor_hour.unwrap_or(local_anchor_reference.hour());\n                    let minute = anchor_minute.unwrap_or(0);\n                    let anchor_naive = local_anchor_reference\n                        .date_naive()\n                        .and_hms_opt(hour, minute, 0)","sourceCodeStart":462,"sourceCodeEnd":498,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/automation_manager.rs#L462-L498","documentation":"AutomationSchedule::next_after_in_timezone throws this for a Once schedule whose single run time `at` is not strictly after the requested `after` instant. A one-shot automation has exactly one occurrence, so if that instant has already passed there is no future run to return. It surfaces as an anyhow bail from the schedule iterator when the automation is evaluated after its scheduled time.","triggerScenarios":"Calling next_after_with_anchor / next_after_in_timezone on an AutomationSchedule::Once whose `at` (parsed from RRULE FREQ=ONCE;AT=...) is <= the `after` DateTime<Utc> passed in — typically because the ONCE time already elapsed before evaluation.","commonSituations":"A user creates a one-shot automation for a time that has already passed (or in the past timezone), the TUI was suspended past the fire time and the scheduler re-queries, or the system clock jumped forward past the scheduled instant.","solutions":["Pick a future AT time when creating the ONCE automation (delete/recreate or edit the schedule with FREQ=ONCE;AT=<future RFC3339 or local time>).","Validate before saving: reject ONCE schedules whose parsed `at` is not in the future.","If the caller just wants to know there is nothing pending, treat this error as an empty result rather than a failure (next_after_slot already returns Ok(None) for Once)."],"exampleFix":"// before\nAutomationSchedule::parse(\"FREQ=ONCE;AT=2020-01-01T09:00\")\n// after\nAutomationSchedule::parse(\"FREQ=ONCE;AT=2026-12-01T09:00:00\")","handlingStrategy":"validation","validationCode":"let at: chrono::DateTime<chrono::Utc> = parse_at(input)?;\nif at <= chrono::Utc::now() {\n    return Err(\"ONCE schedule time must be in the future\");\n}","typeGuard":null,"tryCatchPattern":"match schedule.next_after_with_anchor(now, anchor) {\n    Ok(next) => arm(next),\n    Err(e) if e.to_string().starts_with(\"Once schedule has no future run\") => treat_as_completed(),\n    Err(e) => report(e),\n}","preventionTips":["Default the UI's ONCE time picker to a future timestamp.","Reject past AT values at schedule-creation time.","Treat a passed ONCE schedule as 'completed' state instead of re-querying."],"tags":["scheduling","automation","date-time"],"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"}