Hmbown/CodeWhale · error
fleet task worker.model cannot be empty
Error message
fleet task {task_id} worker.model cannot be empty What it means
The optional worker.model field, when present, must be non-empty. validate_worker_model returns Ok for None but bails on an empty or whitespace-only value. A blank model id would leave the worker without a usable model assignment.
Solutions
- Set a concrete model id for worker.model
- Delete the field (None) if the worker should inherit the default model
- Convert empty strings to None before building the spec
Example fix
# before model: " " # after model: "gpt-4o"
Defensive patterns
Strategy: validation
Validate before calling
fn model_present_ok(m: Option<&str>) -> bool { m.map_or(true, |v| !v.trim().is_empty()) } Type guard
fn clean_model(m: Option<&str>) -> Option<&str> { m.filter(|v| !v.trim().is_empty()) } Try / catch
match validate_worker_model(task_id, value) { Err(e) if e.to_string().contains("cannot be empty") => *value = None, r => r? } Prevention
- Fill model fields from a validated model registry picker
- Treat empty template variables as 'unset', not ''
- Validate the spec immediately after rendering templates
When it happens
Trigger: validate_worker_profile encounters task {task_id} where worker.model is Some("") or only whitespace.
Common situations: Templated specs where the model variable was empty; clearing the model in a UI which wrote ""; YAML `model: ""` left from a template.
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
- Invalid configured model
- invalid model id for `model_context_windows`
- .model_context_windows. must be greater than 0
- 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/9745a74aa8ff9079.
Report an issue: GitHub.
Appendix: source
Thrown at crates/tui/src/fleet/task_spec.rs:289
if trimmed != value || !trimmed.chars().all(is_worker_token_char) {
bail!(
"fleet task {task_id} {field} must be a simple token, not a path or provider/model id"
);
}
Ok(())
}
fn is_worker_token_char(ch: char) -> bool {
ch.is_ascii_alphanumeric() || matches!(ch, '-' | '_' | '.')
}
fn validate_worker_model(task_id: &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} worker.model cannot be empty");
}
if trimmed != value
|| !trimmed
.chars()
.all(|ch| ch.is_ascii_graphic() && !matches!(ch, '=' | '\'' | '"'))
{
bail!(
"fleet task {task_id} worker.model must be a visible model id without whitespace or secrets"
);
}
Ok(())
}
#[allow(clippy::too_many_arguments)]
pub fn write_fleet_artifact_ref(
workspace: &Path,
run_id: &FleetRunId,
task_id: &str,View on GitHub (pinned to 73e0f67d83)