{"record":{"id":"14cac830012beaa1","repo":"Hmbown/CodeWhale","slug":"fire-at-must-be-in-the-future-got-now-is","errorCode":null,"errorMessage":"fire_at must be in the future (got {}, now is {})","messagePattern":"fire_at must be in the future \\(got (.+?), now is (.+?)\\)","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/tui/src/automation_manager.rs","lineNumber":1329,"sourceCode":"                if matches!(\n                    run.status,\n                    AutomationRunStatus::Queued | AutomationRunStatus::Running\n                ) && run.task_id.is_some()\n                {\n                    pending.push(run);\n                }\n            }\n        }\n        Ok(pending)\n    }\n\n    // ── Delayed-trigger storage methods ──────────────────────────────────\n\n    /// Persist a new delayed trigger and return the record.\n    pub fn create_trigger(&self, req: CreateDelayedTriggerRequest) -> Result<DelayedTriggerRecord> {\n        let now = Utc::now();\n        if req.fire_at <= now {\n            bail!(\n                \"fire_at must be in the future (got {}, now is {})\",\n                req.fire_at.to_rfc3339(),\n                now.to_rfc3339()\n            );\n        }\n        if req.message.trim().is_empty() {\n            bail!(\"Trigger message must not be empty\");\n        }\n        let record = DelayedTriggerRecord {\n            schema_version: CURRENT_TRIGGER_SCHEMA_VERSION,\n            trigger_id: format!(\"trig_{}\", Uuid::new_v4().simple()),\n            fire_at: req.fire_at,\n            message: req.message.trim().to_string(),\n            workspace: req.workspace,\n            owner_session_id: req.owner_session_id,\n            status: DelayedTriggerStatus::Pending,\n            created_at: now,\n            fired_at: None,","sourceCodeStart":1311,"sourceCodeEnd":1347,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/0c42157ee52f9d55af2b506d71b46249910f77d3/crates/tui/src/automation_manager.rs#L1311-L1347","documentation":"create_trigger requires fire_at to be strictly greater than Utc::now() at creation time; equality also fails. The error echoes both timestamps in RFC3339 so clock skew or a stale payload is visible in the message itself.","triggerScenarios":"Passing a fire_at already in the past; recomputing fire_at from a clock that is behind; replaying a stored CreateDelayedTriggerRequest after its time has passed; passing exactly now.","commonSituations":"Retry queues replaying old requests; VMs or containers with drifted clocks; naive local times parsed as UTC and shifted into the past.","solutions":["Compute fire_at as Utc::now() + delay at submission time, not earlier","Drop stored requests whose fire_at has passed instead of replaying them","Sync the system clock (NTP) if the printed 'now' disagrees with expectation","Add a minimum lead (e.g. +30 seconds) to absorb processing delay"],"exampleFix":"// before\nlet fire_at = chrono::Utc::now() - chrono::Duration::minutes(5);\n\n// after\nlet fire_at = chrono::Utc::now() + chrono::Duration::hours(1);","handlingStrategy":"validation","validationCode":"fn fire_at_submittable(fire_at: chrono::DateTime<chrono::Utc>) -> bool {\n    fire_at > chrono::Utc::now() + chrono::Duration::seconds(1) // small lead for safety\n}","typeGuard":"fn is_future_timestamp(t: chrono::DateTime<chrono::Utc>) -> bool { t > chrono::Utc::now() }","tryCatchPattern":"match manager.create_trigger(req) {\n    Ok(trig) => { /* ... */ }\n    Err(e) if e.to_string().contains(\"must be in the future\") => {\n        // Drop or recompute the timestamp; do not blind-retry the same payload.\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Compute fire_at from Utc::now() at submission time, never reuse stale values","Drop queued requests whose fire_at has already passed","Keep system clocks NTP-synced; the error message prints both timestamps for comparison","Add a minimum lead (e.g. 30 seconds) to absorb processing delay"],"tags":["rust","datetime","validation","trigger","clock-skew"],"backgroundTag":"scheduled-time-in-past","analyzedSha":"0c42157ee52f9d55af2b506d71b46249910f77d3","analyzedAt":"2026-08-20T21:50:45.477Z","schemaVersion":2},"datasetVersion":"2026-08-22T04:17:13.399Z"}