Hmbown/CodeWhale · error

duplicate fleet worker id

Error message

duplicate fleet worker id {}

What it means

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.

Solutions

  1. Assign each [[workers]] entry a distinct id
  2. If multiple similar workers are intended, use numbered ids (worker-1, worker-2)
  3. Grep the spec for duplicate worker `id = "..."` values

Example fix

# before
[[workers]]
id = "w1"
[[workers]]
id = "w1"
# after
[[workers]]
id = "w1"
[[workers]]
id = "w2"
Defensive patterns

Strategy: validation

Validate before calling

let mut ids = std::collections::BTreeSet::new();
for w in &doc.workers {
    if !ids.insert(w.id.clone()) {
        return Err(format!("duplicate worker id: {}", w.id));
    }
}

Try / catch

match load_task_spec_document(path) {
    Ok(doc) => doc,
    Err(e) if e.to_string().contains("duplicate fleet worker id") => {
        eprintln!("{}: rename one of the duplicate worker ids", path.display());
        return;
    }
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: 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.

Common situations: Duplicating a worker block to add capacity without renaming; generated specs whose worker-id template lacks uniqueness.

Related errors


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

Appendix: source

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

        validate_worker_profile(&task.id, task.worker.as_ref())?;
        if task
            .metadata
            .contains_key(super::worker_runtime::FROZEN_FLEET_MEMBER_METADATA_KEY)
        {
            bail!(
                "fleet task {} metadata key {} is reserved for the durable Runtime selection receipt",
                task.id,
                super::worker_runtime::FROZEN_FLEET_MEMBER_METADATA_KEY
            );
        }
        validate_tags(&task.id, &task.tags)?;
        validate_workspace_requirements(task)?;
    }
    let mut worker_ids = BTreeSet::new();
    for worker in &doc.workers {
        validate_fleet_identity("worker id", &worker.id)?;
        if !worker_ids.insert(worker.id.clone()) {
            bail!("duplicate fleet worker id {}", worker.id);
        }
        validate_fleet_name(&format!("worker {} name", worker.id), &worker.name)?;
        if worker.trust_level.is_some() {
            bail!(
                "fleet worker {} trust_level is a legacy compatibility field, not Fleet identity; configure execution authority through Runtime policy",
                worker.id
            );
        }
    }
    Ok(())
}

fn validate_fleet_identity(field: &str, value: &str) -> Result<()> {
    if value.is_empty() {
        bail!("fleet {field} cannot be empty");
    }
    if value.len() > MAX_FLEET_ID_BYTES || !value.chars().all(is_worker_token_char) {
        bail!(

View on GitHub (pinned to 73e0f67d83)