{"record":{"id":"9745a74aa8ff9079","repo":"Hmbown/CodeWhale","slug":"fleet-task-task-id-worker-model-cannot-be-empty","errorCode":null,"errorMessage":"fleet task {task_id} worker.model cannot be empty","messagePattern":"fleet task (.+?) worker\\.model cannot be empty","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/fleet/task_spec.rs","lineNumber":289,"sourceCode":"    if trimmed != value || !trimmed.chars().all(is_worker_token_char) {\n        bail!(\n            \"fleet task {task_id} {field} must be a simple token, not a path or provider/model id\"\n        );\n    }\n    Ok(())\n}\n\nfn is_worker_token_char(ch: char) -> bool {\n    ch.is_ascii_alphanumeric() || matches!(ch, '-' | '_' | '.')\n}\n\nfn validate_worker_model(task_id: &str, value: Option<&str>) -> Result<()> {\n    let Some(value) = value else {\n        return Ok(());\n    };\n    let trimmed = value.trim();\n    if trimmed.is_empty() {\n        bail!(\"fleet task {task_id} worker.model cannot be empty\");\n    }\n    if trimmed != value\n        || !trimmed\n            .chars()\n            .all(|ch| ch.is_ascii_graphic() && !matches!(ch, '=' | '\\'' | '\"'))\n    {\n        bail!(\n            \"fleet task {task_id} worker.model must be a visible model id without whitespace or secrets\"\n        );\n    }\n    Ok(())\n}\n\n#[allow(clippy::too_many_arguments)]\npub fn write_fleet_artifact_ref(\n    workspace: &Path,\n    run_id: &FleetRunId,\n    task_id: &str,","sourceCodeStart":271,"sourceCodeEnd":307,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/fleet/task_spec.rs#L271-L307","documentation":"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.","triggerScenarios":"validate_worker_profile encounters task {task_id} where worker.model is Some(\"\") or only whitespace.","commonSituations":"Templated specs where the model variable was empty; clearing the model in a UI which wrote \"\"; YAML `model: \"\"` left from a template.","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"],"exampleFix":"# before\nmodel: \"   \"\n# after\nmodel: \"gpt-4o\"","handlingStrategy":"validation","validationCode":"fn model_present_ok(m: Option<&str>) -> bool { m.map_or(true, |v| !v.trim().is_empty()) }","typeGuard":"fn clean_model(m: Option<&str>) -> Option<&str> { m.filter(|v| !v.trim().is_empty()) }","tryCatchPattern":"match validate_worker_model(task_id, value) { Err(e) if e.to_string().contains(\"cannot be empty\") => *value = None, r => r? }","preventionTips":["Fill model fields from a validated model registry picker","Treat empty template variables as 'unset', not ''","Validate the spec immediately after rendering templates"],"tags":["validation","config","model"],"backgroundTag":"empty-required-field","analyzedSha":"73e0f67d83c59909b571efdfc88c4bc28c309cb1","analyzedAt":"2026-09-22T01:30:00.501Z","contentChangedAt":"2026-09-22T01:30:00.501Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}