{"record":{"id":"38b8e9095a16db3d","repo":"Hmbown/CodeWhale","slug":"fleet-task-spec-must-include-at-least-one-task","errorCode":null,"errorMessage":"fleet task spec must include at least one task","messagePattern":"fleet task spec must include at least one task","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/fleet/task_spec.rs","lineNumber":159,"sourceCode":"    let parsed = match path.extension().and_then(|s| s.to_str()) {\n        Some(\"toml\") => toml::from_str::<FleetTaskSpecFile>(&raw)\n            .with_context(|| format!(\"parsing TOML fleet task spec {}\", path.display()))?,\n        _ => serde_json::from_str::<FleetTaskSpecFile>(&raw)\n            .with_context(|| format!(\"parsing JSON fleet task spec {}\", path.display()))?,\n    };\n    let doc = parsed.into_document(fallback_name);\n    validate_task_spec_document(&doc)?;\n    Ok(doc)\n}\n\npub fn validate_task_spec_document(doc: &FleetTaskSpecDocument) -> Result<()> {\n    if doc.security_policy.is_some() {\n        bail!(\n            \"fleet task spec security_policy is a legacy compatibility field, not executable Fleet identity; configure trust, secrets, approvals, sandboxing, and tool authority through Runtime policy\"\n        );\n    }\n    if doc.tasks.is_empty() {\n        bail!(\"fleet task spec must include at least one task\");\n    }\n    let mut ids = BTreeSet::new();\n    for task in &doc.tasks {\n        validate_fleet_identity(\"task id\", &task.id)?;\n        if !ids.insert(task.id.clone()) {\n            bail!(\"duplicate fleet task id {}\", task.id);\n        }\n        validate_fleet_name(&format!(\"task {} name\", task.id), &task.name)?;\n        if task.instructions.trim().is_empty() {\n            bail!(\"fleet task {} instructions cannot be empty\", task.id);\n        }\n        if let Some(objective) = &task.objective\n            && objective.trim().is_empty()\n        {\n            bail!(\"fleet task {} objective cannot be empty\", task.id);\n        }\n        validate_worker_profile(&task.id, task.worker.as_ref())?;\n        if task","sourceCodeStart":141,"sourceCodeEnd":177,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/fleet/task_spec.rs#L141-L177","documentation":"validate_task_spec_document requires a spec document to contain at least one task; an empty tasks list — a spec file carrying only a name or security policy — is rejected at load time and at run creation.","triggerScenarios":"Calling load_task_spec_document or create_queued_run_with_descriptor with a spec file that defines workers/metadata but no [[tasks]] entries.","commonSituations":"Starting a new spec from an empty template; deleting all task blocks during cleanup; a script generating specs that emits zero [[tasks]] sections due to a loop bug.","solutions":["Add at least one [[tasks]] block with a valid id, name, and instructions","Check the generator/script that produced the spec for an empty-tasks bug","Validate the document before queueing the run"],"exampleFix":"# before\n[[workers]]\nid = \"w1\"\n# after\n[[workers]]\nid = \"w1\"\n\n[[tasks]]\nid = \"build\"\nname = \"Build\"\ninstructions = \"Run the build\"","handlingStrategy":"validation","validationCode":"if doc.tasks.is_empty() {\n    return Err(\"task spec needs at least one [[tasks]] block\".into());\n}","typeGuard":null,"tryCatchPattern":"match load_task_spec_document(path) {\n    Ok(doc) => doc,\n    Err(e) if e.to_string().contains(\"must include at least one task\") => {\n        eprintln!(\"{}: no [[tasks]] blocks found\", path.display());\n        return;\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Start new specs from a template that includes a sample task","Check spec-generating scripts for empty task loops","Validate documents before create_queued_run_with_descriptor"],"tags":["config","fleet","validation"],"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"}