{"record":{"id":"bff130af5824f4f3","repo":"Hmbown/CodeWhale","slug":"fleet-task-task-id-has-duplicate-tag-tag","errorCode":null,"errorMessage":"fleet task {task_id} has duplicate tag {tag}","messagePattern":"fleet task (.+?) has duplicate tag (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/fleet/task_spec.rs","lineNumber":452,"sourceCode":"pub fn record_verification_receipt(\n    ledger: &FleetLedger,\n    workspace: &Path,\n    input: &FleetTaskVerificationInput,\n    verification: FleetTaskVerification,\n) -> Result<FleetReceipt> {\n    let receipt = prepare_verification_receipt(workspace, input, verification)?;\n    ledger.record_receipt(receipt.clone())?;\n    Ok(receipt)\n}\n\nfn validate_tags(task_id: &str, tags: &[String]) -> Result<()> {\n    let mut seen = BTreeSet::new();\n    for tag in tags {\n        if tag.trim().is_empty() {\n            bail!(\"fleet task {task_id} tag cannot be empty\");\n        }\n        if !seen.insert(tag) {\n            bail!(\"fleet task {task_id} has duplicate tag {tag}\");\n        }\n    }\n    Ok(())\n}\n\nfn validate_workspace_requirements(task: &FleetTaskSpec) -> Result<()> {\n    let Some(workspace) = &task.workspace else {\n        return Ok(());\n    };\n    let env = workspace.environment.as_ref();\n    for name in env\n        .into_iter()\n        .flat_map(|env| env.required.iter().chain(env.allowlist.iter()))\n    {\n        if name.trim().is_empty() {\n            bail!(\n                \"fleet task {} environment variable name cannot be empty\",\n                task.id","sourceCodeStart":434,"sourceCodeEnd":470,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/fleet/task_spec.rs#L434-L470","documentation":"Fleet task spec validation rejects duplicate tags within one task's tag list. validate_tags tracks tags in a BTreeSet; a second occurrence of an already-seen tag fails validation since duplicates are meaningless and can cause double-matching in filters.","triggerScenarios":"Calling validate_task_spec_document with a FleetTaskSpec whose tags array contains the same tag string twice, e.g. [\"gpu\",\"gpu\"].","commonSituations":"Merging two task configs by concatenating tag arrays; a user typing a tag twice in a form; defaults merged with user-supplied tags without dedup.","solutions":["Deduplicate the tags array (e.g. via a set) before building the spec.","Remove one of the duplicate entries in the spec document.","Normalize tags at input time so repeats collapse."],"exampleFix":"// before\n\"tags\": [\"gpu\", \"gpu\"]\n// after\n\"tags\": [\"gpu\"]","handlingStrategy":"validation","validationCode":"fn tags_unique(tags: &[String]) -> bool { tags.len() == tags.iter().collect::<std::collections::BTreeSet<_>>().len() }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Deduplicate tags via a set when merging specs","Normalize tags at input time","Unit-test spec builders for merged tag lists"],"tags":["validation","fleet","duplicate"],"backgroundTag":"invalid-argument-value","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"}