Hmbown/CodeWhale · error · anyhow::Error
Automation prompt cannot be empty
Error message
Automation prompt cannot be empty
What it means
update_automation rejects a prompt update whose value trims to empty. Only Some(prompt) triggers validation; omitting the field leaves the prompt unchanged. The trimmed value is persisted and later executed.
Source
Thrown at crates/tui/src/automation_manager.rs:1051
Ok(out)
}
pub fn update_automation(
&self,
id: &str,
req: UpdateAutomationRequest,
) -> Result<AutomationRecord> {
let mut existing = self.get_automation(id)?;
if let Some(name) = req.name {
if name.trim().is_empty() {
bail!("Automation name cannot be empty");
}
existing.name = name.trim().to_string();
}
if let Some(prompt) = req.prompt {
if prompt.trim().is_empty() {
bail!("Automation prompt cannot be empty");
}
existing.prompt = prompt.trim().to_string();
}
if let Some(rrule) = req.rrule {
let normalized = rrule.trim().to_ascii_uppercase();
AutomationSchedule::parse_rrule(&normalized)?;
existing.rrule = normalized;
if matches!(existing.status, AutomationStatus::Active) {
let schedule = AutomationSchedule::parse_rrule(&existing.rrule)?;
existing.next_run_at =
Some(schedule.next_after_with_anchor(Utc::now(), existing.created_at)?);
}
}
if let Some(cwds) = req.cwds {
existing.cwds = cwds;
}
if let Some(mode) = req.mode {
existing.mode = normalize_optional_string(Some(mode));View on GitHub (pinned to 0c42157ee5)
Solutions
- Send a non-empty prompt, or omit the field to keep the current prompt
- Validate trim-ness before submitting the update
- Default templates to a descriptive fallback string
Example fix
// before
let req = UpdateAutomationRequest { prompt: Some(" ".to_string()), ..Default::default() };
// after
let req = UpdateAutomationRequest { prompt: Some("Summarize today's incidents".to_string()), ..Default::default() }; Defensive patterns
Strategy: validation
Validate before calling
fn prompt_update_ok(prompt: &Option<String>) -> bool {
prompt.as_deref().is_none_or(|p| !p.trim().is_empty())
} Type guard
fn is_non_blank(s: &str) -> bool { !s.trim().is_empty() } Prevention
- Require visible text for prompts in the UI before enabling submit
- Omit the prompt field instead of sending an empty string for no-change
- Give templates a descriptive fallback so rendered prompts are never blank
When it happens
Trigger: Calling update_automation with UpdateAutomationRequest { prompt: Some(String::new()), .. } or Some("\t".into()).
Common situations: Template-rendered prompts whose variables resolve to whitespace; UIs submitting unvalidated textarea content; scripts defaulting to empty strings.
Related errors
- Automation name cannot be empty
- Trigger message must not be empty
- {kind} must not be empty
- Automation name is required
- Automation prompt is required
AI-assisted analysis of Hmbown/CodeWhale@0c42157ee5 (2026-08-20).
Data as JSON: /api/errors/e370f5ea2e502eb8.
Report an issue: GitHub.