{"record":{"id":"a8875ad1875a4f44","repo":"Hmbown/CodeWhale","slug":"duplicate-fleet-task-id","errorCode":null,"errorMessage":"duplicate fleet task id {}","messagePattern":"duplicate fleet task id (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/fleet/task_spec.rs","lineNumber":165,"sourceCode":"    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\n            .metadata\n            .contains_key(super::worker_runtime::FROZEN_FLEET_MEMBER_METADATA_KEY)\n        {\n            bail!(\n                \"fleet task {} metadata key {} is reserved for the durable Runtime selection receipt\",\n                task.id,","sourceCodeStart":147,"sourceCodeEnd":183,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/fleet/task_spec.rs#L147-L183","documentation":"Task ids within a fleet task spec must be unique. validate_task_spec_document (crates/tui/src/fleet/task_spec.rs:165) tracks ids in a BTreeSet and bails on the first repeated task id, because ids identify tasks and workers within a run.","triggerScenarios":"A spec document contains two or more [[tasks]] blocks with the same `id`; detected during load_task_spec_document or create_queued_run_with_descriptor.","commonSituations":"Copy-pasting a task block to create a variant and forgetting to change the id; generated specs where an id template does not include an index.","solutions":["Give each [[tasks]] block a distinct id","If tasks were meant to be variants, append a suffix (build-1, build-2)","Search the spec for duplicate `id = \"...\"` values under [tasks]"],"exampleFix":"# before\n[[tasks]]\nid = \"build\"\n[[tasks]]\nid = \"build\"\n# after\n[[tasks]]\nid = \"build\"\n[[tasks]]\nid = \"test\"","handlingStrategy":"validation","validationCode":"let mut ids = std::collections::BTreeSet::new();\nfor t in &doc.tasks {\n    if !ids.insert(t.id.clone()) {\n        return Err(format!(\"duplicate task id: {}\", t.id));\n    }\n}","typeGuard":null,"tryCatchPattern":"match load_task_spec_document(path) {\n    Ok(doc) => doc,\n    Err(e) if e.to_string().contains(\"duplicate fleet task id\") => {\n        eprintln!(\"{}: rename one of the duplicate task ids\", path.display());\n        return;\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Use id templates that include an index for generated task blocks","Check for duplicate ids after editing spec files","Keep a lint step that dedupes task ids in CI"],"tags":["config","fleet","validation","duplicates"],"backgroundTag":"duplicate-identifier","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"}