Hmbown/CodeWhale · error
fleet task cannot be empty
Error message
fleet task {task_id} {field} cannot be empty What it means
Worker selector fields are optional, but when present they must be non-empty. validate_worker_selector returns Ok for None but bails on an empty or whitespace-only Some value. This prevents passing a blank selector that would never match a worker.
Solutions
- Remove the field entirely (or set it to None) if no selector is needed
- Provide a non-empty selector value
- Normalize empty strings to None before validation
Example fix
// before
selector: Some("")
// after
selector: None // or Some("gpu=true") Defensive patterns
Strategy: validation
Validate before calling
fn selector_present_ok(s: Option<&str>) -> bool { s.map_or(true, |v| !v.trim().is_empty()) } Type guard
fn clean_selector(s: Option<&str>) -> Option<&str> { s.filter(|v| !v.trim().is_empty()) } Try / catch
match validate_worker_selector(task_id, "selector", value) { Err(e) if e.to_string().contains("cannot be empty") => *value = None, r => r? } Prevention
- Omit the key rather than writing an empty string
- Normalize "" to None when deserializing optional fields
- Validate user form input before constructing the spec
When it happens
Trigger: validate_worker_profile (via validate_task_spec_document) sees task {task_id} with an optional selector field set to Some("") or Some(" ").
Common situations: A UI or script writing Some/default-empty into an optional field instead of omitting it; deserializing YAML with `selector: ""` rather than dropping the key.
Understand the failure class
Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.
Related errors
- agent profile cannot be empty
- agent profile must be a simple token
- agent profile model must be a visible model id without…
- agent profile provider cannot be empty
- agent profile provider must be a simple provider id
AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22).
Data as JSON: /api/errors/a6ee17ee3bb4903f.
Report an issue: GitHub.
Appendix: source
Thrown at crates/tui/src/fleet/task_spec.rs:252
};
validate_worker_selector(
task_id,
"worker.agent_profile",
worker.agent_profile.as_deref(),
)?;
validate_worker_token(task_id, "worker.loadout", worker.loadout.as_deref())?;
validate_worker_token(task_id, "worker.model_class", worker.model_class.as_deref())?;
validate_worker_model(task_id, worker.model.as_deref())?;
Ok(())
}
fn validate_worker_selector(task_id: &str, field: &str, value: Option<&str>) -> Result<()> {
let Some(value) = value else {
return Ok(());
};
let trimmed = value.trim();
if trimmed.is_empty() {
bail!("fleet task {task_id} {field} cannot be empty");
}
if trimmed != value || value.len() > MAX_FLEET_NAME_BYTES || value.chars().any(char::is_control)
{
bail!(
"fleet task {task_id} {field} must be one printable selector no longer than {MAX_FLEET_NAME_BYTES} bytes"
);
}
Ok(())
}
fn validate_worker_token(task_id: &str, field: &str, value: Option<&str>) -> Result<()> {
let Some(value) = value else {
return Ok(());
};
let trimmed = value.trim();
if trimmed.is_empty() {
bail!("fleet task {task_id} {field} cannot be empty");
}View on GitHub (pinned to 73e0f67d83)