Hmbown/CodeWhale · error

fleet must be a simple ASCII token no longer than bytes

Error message

fleet {field} must be a simple ASCII token no longer than {MAX_FLEET_ID_BYTES} bytes

What it means

Fleet identity fields must be a plain ASCII token of at most MAX_FLEET_ID_BYTES bytes. validate_fleet_identity rejects values that are too long or contain characters outside the worker-token charset. This keeps fleet ids safe to embed in paths, protocol messages, and identifiers without escaping.

Solutions

  1. Shorten the value to at most MAX_FLEET_ID_BYTES bytes
  2. Replace disallowed characters so only is_worker_token_char-accepted ASCII chars remain
  3. Move descriptive text to the fleet name field instead and keep the id a simple token

Example fix

// before
let id = "team/production fleet #1";
// after
let id = "team-prod-1";
Defensive patterns

Strategy: validation

Validate before calling

fn valid_fleet_id(v: &str) -> bool { !v.is_empty() && v.len() <= MAX_FLEET_ID_BYTES && v.chars().all(is_worker_token_char) }

Type guard

fn as_fleet_id(v: &str) -> Option<&str> { valid_fleet_id(v).then_some(v) }

Try / catch

if let Err(e) = validate_task_spec_document(&doc) { if e.to_string().contains("simple ASCII token") { sanitize_and_retry(&mut doc); } }

Prevention

When it happens

Trigger: validate_task_spec_document reaches validate_fleet_identity with a value whose byte length exceeds MAX_FLEET_ID_BYTES or which contains any character not accepted by is_worker_token_char (spaces, slashes, ':' etc.).

Common situations: Pasting a provider/model id like 'openai/gpt-4o' or a path into the fleet id field; very long descriptive ids; Unicode or whitespace in the id.

Understand the failure class

Background: "invalid id" errors: invalid identifier format — why libraries reject IDs before lookup, and how to fix them — this error's family across 37 libraries.

Related errors


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

Appendix: source

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

            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"
        );
    }
    Ok(())
}

View on GitHub (pinned to 73e0f67d83)