{"record":{"id":"2388c79bb085ff95","repo":"Hmbown/CodeWhale","slug":"duplicate-fleet-worker-id","errorCode":null,"errorMessage":"duplicate fleet worker id {}","messagePattern":"duplicate fleet worker id (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/fleet/task_spec.rs","lineNumber":194,"sourceCode":"        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,\n                super::worker_runtime::FROZEN_FLEET_MEMBER_METADATA_KEY\n            );\n        }\n        validate_tags(&task.id, &task.tags)?;\n        validate_workspace_requirements(task)?;\n    }\n    let mut worker_ids = BTreeSet::new();\n    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!(","sourceCodeStart":176,"sourceCodeEnd":212,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/fleet/task_spec.rs#L176-L212","documentation":"Worker ids within a fleet task spec must be unique. validate_task_spec_document (crates/tui/src/fleet/task_spec.rs:194) inserts each worker id into a BTreeSet and bails on duplicates, since task-to-worker references rely on unique ids.","triggerScenarios":"The document contains two [workers] entries (or repeated [[workers]] blocks) with the same `id`, encountered while validating via load_task_spec_document or create_queued_run_with_descriptor.","commonSituations":"Duplicating a worker block to add capacity without renaming; generated specs whose worker-id template lacks uniqueness.","solutions":["Assign each [[workers]] entry a distinct id","If multiple similar workers are intended, use numbered ids (worker-1, worker-2)","Grep the spec for duplicate worker `id = \"...\"` values"],"exampleFix":"# before\n[[workers]]\nid = \"w1\"\n[[workers]]\nid = \"w1\"\n# after\n[[workers]]\nid = \"w1\"\n[[workers]]\nid = \"w2\"","handlingStrategy":"validation","validationCode":"let mut ids = std::collections::BTreeSet::new();\nfor w in &doc.workers {\n    if !ids.insert(w.id.clone()) {\n        return Err(format!(\"duplicate worker id: {}\", w.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 worker id\") => {\n        eprintln!(\"{}: rename one of the duplicate worker ids\", path.display());\n        return;\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Number generated worker ids (worker-1, worker-2, ...)","Check for duplicate ids after duplicating worker blocks","Add a duplicate-id lint to spec 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"}