{"record":{"id":"54d4bffa648b4ff3","repo":"Hmbown/CodeWhale","slug":"trigger-message-must-not-be-empty","errorCode":null,"errorMessage":"Trigger message must not be empty","messagePattern":"Trigger message must not be empty","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/tui/src/automation_manager.rs","lineNumber":1336,"sourceCode":"            }\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,\n            task_id: None,\n            thread_id: None,\n            error: None,\n            parent_trigger_id: req.parent_trigger_id,\n        };\n        self.save_trigger(&record)?;\n        Ok(record)","sourceCodeStart":1318,"sourceCodeEnd":1354,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/0c42157ee52f9d55af2b506d71b46249910f77d3/crates/tui/src/automation_manager.rs#L1318-L1354","documentation":"create_trigger rejects a message that trims to empty. The trimmed message is stored and delivered when the trigger fires, so blank strings are refused up front, after the fire_at check.","triggerScenarios":"CreateDelayedTriggerRequest { message: String::new(), fire_at: future } or message: \"   \"; templated messages that render to only whitespace.","commonSituations":"UIs submitting unvalidated textarea content; templates with empty variables; API scripts defaulting the message to an empty string.","solutions":["Provide a non-empty message describing what the trigger should do","Validate trim-ness before submitting","Default templated messages to a descriptive fallback string"],"exampleFix":"// before\nlet req = CreateDelayedTriggerRequest { fire_at, message: \"   \".to_string(), .. };\n\n// after\nlet req = CreateDelayedTriggerRequest { fire_at, message: \"Run the nightly backup now\".to_string(), .. };","handlingStrategy":"validation","validationCode":"fn trigger_message_ok(msg: &str) -> bool { !msg.trim().is_empty() }","typeGuard":"fn is_non_blank(s: &str) -> bool { !s.trim().is_empty() }","tryCatchPattern":null,"preventionTips":["Require visible text for the trigger message in the UI before submit","Give templated messages a descriptive fallback value","Validate trim-ness before calling create_trigger so the fire_at check is not wasted"],"tags":["rust","validation","empty-string","trigger"],"backgroundTag":"required-field-empty","analyzedSha":"0c42157ee52f9d55af2b506d71b46249910f77d3","analyzedAt":"2026-08-20T21:50:45.477Z","schemaVersion":2},"datasetVersion":"2026-08-22T04:17:13.399Z"}