Hmbown/CodeWhale · error

fleet task has duplicate tag

Error message

fleet task {task_id} has duplicate tag {tag}

What it means

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.

Solutions

  1. Deduplicate the tags array (e.g. via a set) before building the spec.
  2. Remove one of the duplicate entries in the spec document.
  3. Normalize tags at input time so repeats collapse.

Example fix

// before
"tags": ["gpu", "gpu"]
// after
"tags": ["gpu"]
Defensive patterns

Strategy: validation

Validate before calling

fn tags_unique(tags: &[String]) -> bool { tags.len() == tags.iter().collect::<std::collections::BTreeSet<_>>().len() }

Prevention

When it happens

Trigger: Calling validate_task_spec_document with a FleetTaskSpec whose tags array contains the same tag string twice, e.g. ["gpu","gpu"].

Common situations: 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.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22). Data as JSON: /api/errors/bff130af5824f4f3. Report an issue: GitHub.

Appendix: source

Thrown at crates/tui/src/fleet/task_spec.rs:452

pub fn record_verification_receipt(
    ledger: &FleetLedger,
    workspace: &Path,
    input: &FleetTaskVerificationInput,
    verification: FleetTaskVerification,
) -> Result<FleetReceipt> {
    let receipt = prepare_verification_receipt(workspace, input, verification)?;
    ledger.record_receipt(receipt.clone())?;
    Ok(receipt)
}

fn validate_tags(task_id: &str, tags: &[String]) -> Result<()> {
    let mut seen = BTreeSet::new();
    for tag in tags {
        if tag.trim().is_empty() {
            bail!("fleet task {task_id} tag cannot be empty");
        }
        if !seen.insert(tag) {
            bail!("fleet task {task_id} has duplicate tag {tag}");
        }
    }
    Ok(())
}

fn validate_workspace_requirements(task: &FleetTaskSpec) -> Result<()> {
    let Some(workspace) = &task.workspace else {
        return Ok(());
    };
    let env = workspace.environment.as_ref();
    for name in env
        .into_iter()
        .flat_map(|env| env.required.iter().chain(env.allowlist.iter()))
    {
        if name.trim().is_empty() {
            bail!(
                "fleet task {} environment variable name cannot be empty",
                task.id

View on GitHub (pinned to 73e0f67d83)