Hmbown/CodeWhale · error · anyhow::Error
Automation name is required
Error message
Automation name is required
What it means
create_automation runs validate_name_and_prompt before persisting and rejects names that are empty after trimming. Automation records are user-facing and addressed by name, so a blank name is refused at the API boundary rather than stored.
Source
Thrown at crates/tui/src/automation_manager.rs:1844
);
}
Ok(run)
}
fn ensure_safe_storage_id(kind: &str, value: &str) -> Result<()> {
let mut components = Path::new(value).components();
let Some(component) = components.next() else {
bail!("{kind} must not be empty");
};
if components.next().is_some() || !matches!(component, std::path::Component::Normal(_)) {
bail!("{kind} must be a single path component");
}
Ok(())
}
fn validate_name_and_prompt(name: &str, prompt: &str) -> Result<()> {
if name.trim().is_empty() {
bail!("Automation name is required");
}
if prompt.trim().is_empty() {
bail!("Automation prompt is required");
}
Ok(())
}
fn normalize_optional_string(value: Option<String>) -> Option<String> {
value
.map(|value| value.trim().to_string())
.filter(|value| !value.is_empty())
}
fn write_json_atomic<T: Serialize>(path: &Path, value: &T) -> Result<()> {
if let Some(parent) = path.parent() {
fs::create_dir_all(parent)
.with_context(|| format!("Failed to create {}", parent.display()))?;
}View on GitHub (pinned to 0c42157ee5)
Solutions
- Supply a non-blank name — any non-whitespace content counts after trimming.
- Add a required-field check in the UI/CLI before calling create_automation.
- Trim input at the boundary so whitespace-only values fail visibly and early.
Example fix
// before
let record = manager.create_automation(CreateAutomationRequest {
name: " ".to_string(), // blank after trim -> bails
prompt: prompt.to_string(),
})?;
// after
let name = user_name.trim();
anyhow::ensure!(!name.is_empty(), "Name cannot be blank");
let record = manager.create_automation(CreateAutomationRequest {
name: name.to_string(),
prompt: prompt.to_string(),
})?; Defensive patterns
Strategy: validation
Validate before calling
fn valid_automation_name(name: &str) -> bool {
!name.trim().is_empty()
} Prevention
- Mark the name field required in forms and reject whitespace-only input client-side.
- Trim at the input boundary so blank values fail visibly.
- Pre-validate CreateAutomationRequest fields in one place before calling the manager.
When it happens
Trigger: Calling AutomationManager::create_automation (or the update path that shares the validator) with req.name set to "", " ", or any string that is whitespace-only after trim.
Common situations: A form or CLI invocation submitted without a name; whitespace-only input passing a naive length check; a script defaulting the name to an empty string.
Related errors
- Automation prompt is required
- Automation name cannot be empty
- Automation prompt cannot be empty
- {kind} must not be empty
- Speech model cannot be empty
AI-assisted analysis of Hmbown/CodeWhale@0c42157ee5 (2026-08-20).
Data as JSON: /api/errors/42c9a881a9ab4c29.
Report an issue: GitHub.