Hmbown/CodeWhale · error · anyhow::Error
Automation name cannot be empty
Error message
Automation name cannot be empty
What it means
update_automation rejects a name update whose value trims to empty. Only Some(name) triggers validation; omitting the field leaves the name unchanged. The trimmed value is what gets persisted.
Source
Thrown at crates/tui/src/automation_manager.rs:1045
CURRENT_AUTOMATION_SCHEMA_VERSION
);
}
out.push(record);
}
out.sort_by_key(|r| std::cmp::Reverse(r.updated_at));
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)?);
}View on GitHub (pinned to 0c42157ee5)
Solutions
- Send a non-empty name, or omit the field to keep the current name
- Trim client-side and skip the update when the result is empty
- Treat an emptied edit field as a no-op upstream of the request
Example fix
// before
let req = UpdateAutomationRequest { name: Some(" ".to_string()), ..Default::default() };
// after (leave the name unchanged)
let req = UpdateAutomationRequest { name: None, ..Default::default() }; Defensive patterns
Strategy: validation
Validate before calling
fn name_update_ok(name: &Option<String>) -> bool {
name.as_deref().is_none_or(|n| !n.trim().is_empty())
} Type guard
fn is_non_blank(s: &str) -> bool { !s.trim().is_empty() } Prevention
- Trim input client-side and skip the update when the result is empty
- Distinguish 'no change' (omit the field) from 'set to empty' (invalid)
- Reject whitespace-only form submissions before they reach the manager
When it happens
Trigger: Calling update_automation with UpdateAutomationRequest { name: Some(String::new()), .. } or Some(" ".into()).
Common situations: Forms submitting whitespace-only edits; trim mismatches between client and manager; cleared input fields sent as empty strings instead of omitted.
Related errors
- Automation prompt 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/76e1535f57b74ba0.
Report an issue: GitHub.