{"record":{"id":"aeb0bc07f8248ea2","repo":"Hmbown/CodeWhale","slug":"fleet-field-cannot-be-empty","errorCode":null,"errorMessage":"fleet {field} cannot be empty","messagePattern":"fleet (.+?) cannot be empty","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/fleet/task_spec.rs","lineNumber":209,"sourceCode":"    for worker in &doc.workers {\n        validate_fleet_identity(\"worker id\", &worker.id)?;\n        if !worker_ids.insert(worker.id.clone()) {\n            bail!(\"duplicate fleet worker id {}\", worker.id);\n        }\n        validate_fleet_name(&format!(\"worker {} name\", worker.id), &worker.name)?;\n        if worker.trust_level.is_some() {\n            bail!(\n                \"fleet worker {} trust_level is a legacy compatibility field, not Fleet identity; configure execution authority through Runtime policy\",\n                worker.id\n            );\n        }\n    }\n    Ok(())\n}\n\nfn validate_fleet_identity(field: &str, value: &str) -> Result<()> {\n    if value.is_empty() {\n        bail!(\"fleet {field} cannot be empty\");\n    }\n    if value.len() > MAX_FLEET_ID_BYTES || !value.chars().all(is_worker_token_char) {\n        bail!(\n            \"fleet {field} must be a simple ASCII token no longer than {MAX_FLEET_ID_BYTES} bytes\"\n        );\n    }\n    Ok(())\n}\n\nfn validate_fleet_name(field: &str, value: &str) -> Result<()> {\n    if value.trim().is_empty() {\n        bail!(\"fleet {field} cannot be empty\");\n    }\n    if value.len() > MAX_FLEET_NAME_BYTES || value.chars().any(char::is_control) {\n        bail!(\n            \"fleet {field} must be one printable line no longer than {MAX_FLEET_NAME_BYTES} bytes\"\n        );\n    }","sourceCodeStart":191,"sourceCodeEnd":227,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/fleet/task_spec.rs#L191-L227","documentation":"Task-spec document validation requires fleet identity fields (e.g. fleet id) to be non-empty. validate_fleet_identity in crates/tui/src/fleet/task_spec.rs bails when the given value is an empty string. The library rejects empty fleet identifiers up front so tasks never target an unnamed fleet.","triggerScenarios":"Calling validate_task_spec_document on a parsed task spec whose fleet id (or another identity field routed through validate_fleet_identity) is the empty string \"\".","commonSituations":"Hand-written task spec documents with a placeholder left blank; templating that substituted an empty variable; copying a spec template and deleting the id value.","solutions":["Set a non-empty value for the flagged fleet field in the task spec document","Generate an id with the same charset accepted by is_worker_token_char (simple ASCII token)","Re-run validate_task_spec_document to confirm the fix"],"exampleFix":"# before\nfleet:\n  id: \"\"\n# after\nfleet:\n  id: \"alpha-workers\"","handlingStrategy":"validation","validationCode":"fn fleet_field_ok(v: &str) -> bool { !v.is_empty() }","typeGuard":"fn non_empty(v: &str) -> Option<&str> { if v.is_empty() { None } else { Some(v) } }","tryCatchPattern":"match spec.validate() { Err(e) if e.to_string().contains(\"cannot be empty\") => { /* prompt user for the field */ }, Err(e) => return Err(e), Ok(doc) => use(doc) }","preventionTips":["Always fill fleet id fields from templates with a real default","Reject blank values in UI forms before saving the document","Trim inputs and treat whitespace-only as empty early"],"tags":["validation","config","fleet"],"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"}