Hmbown/CodeWhale · error · anyhow::Error

fire_at must be in the future

Error message

fire_at must be in the future (got {}, now is {})

What it means

create_trigger validation: the requested fire_at is not strictly in the future; delayed triggers that would fire immediately or in the past are rejected, and the message carries both the requested and current RFC3339 times for diagnosis.

Solutions

  1. Compute fire_at from a future instant (e.g. Utc::now() + duration) at submission time, accounting for clock skew.
  2. Retry submission with a fresh timestamp if the reject came from a slow path between computing fire_at and calling create_trigger.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/tui/src/automation_manager.rs:1860 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22). Data as JSON: /api/errors/14cac830012beaa1. Report an issue: GitHub.

Appendix: source

Thrown at crates/tui/src/automation_manager.rs:1860

                if matches!(
                    run.status,
                    AutomationRunStatus::Queued | AutomationRunStatus::Running
                ) && run.task_id.is_some()
                {
                    pending.push(run);
                }
            }
        }
        Ok(pending)
    }

    // ── Delayed-trigger storage methods ──────────────────────────────────

    /// Persist a new delayed trigger and return the record.
    pub fn create_trigger(&self, req: CreateDelayedTriggerRequest) -> Result<DelayedTriggerRecord> {
        let now = Utc::now();
        if req.fire_at <= now {
            bail!(
                "fire_at must be in the future (got {}, now is {})",
                req.fire_at.to_rfc3339(),
                now.to_rfc3339()
            );
        }
        if req.message.trim().is_empty() {
            bail!("Trigger message must not be empty");
        }
        let record = DelayedTriggerRecord {
            schema_version: CURRENT_TRIGGER_SCHEMA_VERSION,
            execution_scope: self.execution_scope.clone(),
            trigger_id: format!("trig_{}", Uuid::new_v4().simple()),
            fire_at: req.fire_at,
            message: req.message.trim().to_string(),
            workspace: req.workspace,
            owner_session_id: req.owner_session_id,
            status: DelayedTriggerStatus::Pending,
            created_at: now,

View on GitHub (pinned to 73e0f67d83)