Hmbown/CodeWhale · error

fleet cannot be empty

Error message

fleet {field} cannot be empty

What it means

Task-spec document validation requires fleet identity fields (e.g. fleet id) to be non-empty. validate_fleet_identity in crates/tui/src/fleet/task_spec.rs bails when the given value is an empty string. The library rejects empty fleet identifiers up front so tasks never target an unnamed fleet.

Solutions

  1. Set a non-empty value for the flagged fleet field in the task spec document
  2. Generate an id with the same charset accepted by is_worker_token_char (simple ASCII token)
  3. Re-run validate_task_spec_document to confirm the fix

Example fix

# before
fleet:
  id: ""
# after
fleet:
  id: "alpha-workers"
Defensive patterns

Strategy: validation

Validate before calling

fn fleet_field_ok(v: &str) -> bool { !v.is_empty() }

Type guard

fn non_empty(v: &str) -> Option<&str> { if v.is_empty() { None } else { Some(v) } }

Try / catch

match spec.validate() { Err(e) if e.to_string().contains("cannot be empty") => { /* prompt user for the field */ }, Err(e) => return Err(e), Ok(doc) => use(doc) }

Prevention

When it happens

Trigger: Calling validate_task_spec_document on a parsed task spec whose fleet id (or another identity field routed through validate_fleet_identity) is the empty string "".

Common situations: Hand-written task spec documents with a placeholder left blank; templating that substituted an empty variable; copying a spec template and deleting the id value.

Understand the failure class

Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.

Related errors


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

Appendix: source

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

    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!(
            "fleet {field} must be a simple ASCII token no longer than {MAX_FLEET_ID_BYTES} bytes"
        );
    }
    Ok(())
}

fn validate_fleet_name(field: &str, value: &str) -> Result<()> {
    if value.trim().is_empty() {
        bail!("fleet {field} cannot be empty");
    }
    if value.len() > MAX_FLEET_NAME_BYTES || value.chars().any(char::is_control) {
        bail!(
            "fleet {field} must be one printable line no longer than {MAX_FLEET_NAME_BYTES} bytes"
        );
    }

View on GitHub (pinned to 73e0f67d83)