Hmbown/CodeWhale · error

Fleet task ' ' metadata.coordination_contracts accepts at…

Error message

Fleet task '{}' metadata.coordination_contracts accepts at most 16 entries

What it means

fleet_coordination_contracts enforces a hard bound of 16 coordination contract entries per Fleet task. A metadata.coordination_contracts array longer than 16 is rejected to keep worker coordination claims bounded and reviewable.

Solutions

  1. Consolidate contracts into fewer, broader entries (e.g. one shared-resource lease instead of many).
  2. Split the work across multiple Fleet tasks with at most 16 contracts each.
  3. Deduplicate repeated contract strings in the metadata producer.
  4. Move overflow coordination to a coordinating manager task rather than per-worker contracts.

Example fix

// before: 20 contract entries in one task
// after: dedupe/split
"coordination_contracts": ["lease:db", "lease:api", "lock:idx"] // <= 16
Defensive patterns

Strategy: validation

Validate before calling

if (contracts.length > 16) throw new Error(`coordination_contracts accepts at most 16 entries (got ${contracts.length})`);

Prevention

When it happens

Trigger: fleet_task_to_worker_spec_with_profiles -> fleet_coordination_contracts where task_spec.metadata["coordination_contracts"] is a valid array of strings but values.len() > 16.

Common situations: Generating task specs from a script that appends every shared resource as a contract; bulk-converted legacy configs listing dozens of leases; template expansion duplicating contract entries.

Understand the failure class

Background: "value must be between 0 and 1" / "out of range" / "must not be negative" errors: fixing range-validation failures across open-source libraries — this error's family across 42 libraries.

Related errors


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

Appendix: source

Thrown at crates/tui/src/fleet/worker_runtime.rs:598

    Ok(if segments.is_empty() {
        ".".to_string()
    } else {
        segments.join("/")
    })
}

fn fleet_coordination_contracts(task_spec: &FleetTaskSpec) -> Result<Vec<String>> {
    let Some(value) = task_spec.metadata.get("coordination_contracts") else {
        return Ok(Vec::new());
    };
    let Some(values) = value.as_array() else {
        bail!(
            "Fleet task '{}' metadata.coordination_contracts must be an array of strings",
            task_spec.id
        );
    };
    if values.len() > 16 {
        bail!(
            "Fleet task '{}' metadata.coordination_contracts accepts at most 16 entries",
            task_spec.id
        );
    }
    let mut contracts = Vec::new();
    for value in values {
        let Some(value) = value.as_str() else {
            bail!(
                "Fleet task '{}' metadata.coordination_contracts must contain only strings",
                task_spec.id
            );
        };
        let value = value.trim();
        if value.is_empty()
            || value.chars().count() > 128
            || value.chars().any(|ch| matches!(ch, '\0' | '\r' | '\n'))
        {
            bail!(

View on GitHub (pinned to 73e0f67d83)