Hmbown/CodeWhale · error

fleet task must be a simple token, not a path or…

Error message

fleet task {task_id} {field} must be a simple token, not a path or provider/model id

What it means

Worker tokens must be simple tokens: no leading/trailing whitespace and only characters accepted by is_worker_token_char. validate_worker_token explicitly rejects paths and provider/model ids (which contain '/' or ':'), since tokens are opaque identifiers, not references.

Solutions

  1. Use only simple token characters (no '/', ':', whitespace, paths)
  2. Trim the value before storing it
  3. Move path or provider/model id values to the appropriate fields (worker.model for model ids) instead of a token field

Example fix

// before
token: Some("providers/openai")
// after
token: Some("openai-prod-key")
Defensive patterns

Strategy: validation

Validate before calling

fn token_format_ok(v: &str) -> bool { let t = v.trim(); t == v && !t.is_empty() && t.chars().all(is_worker_token_char) }

Type guard

fn as_worker_token(v: &str) -> Option<&str> { token_format_ok(v).then_some(v) }

Try / catch

if let Err(e) = validate_worker_token(task_id, "token", value) { if e.to_string().contains("simple token") { eprintln!("token must not be a path or model id: {e}"); } }

Prevention

When it happens

Trigger: validate_worker_profile sees a token with surrounding whitespace, or containing characters like '/', ':', '.', spaces that violate the token charset.

Common situations: Putting 'openai/gpt-4o' or '~/.config/creds' into a token field; pasting a value with a trailing newline; shell expansion introducing slashes.

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/05160b5a4da683be. Report an issue: GitHub.

Appendix: source

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

    if trimmed != value || value.len() > MAX_FLEET_NAME_BYTES || value.chars().any(char::is_control)
    {
        bail!(
            "fleet task {task_id} {field} must be one printable selector no longer than {MAX_FLEET_NAME_BYTES} bytes"
        );
    }
    Ok(())
}

fn validate_worker_token(task_id: &str, field: &str, value: Option<&str>) -> Result<()> {
    let Some(value) = value else {
        return Ok(());
    };
    let trimmed = value.trim();
    if trimmed.is_empty() {
        bail!("fleet task {task_id} {field} cannot be empty");
    }
    if trimmed != value || !trimmed.chars().all(is_worker_token_char) {
        bail!(
            "fleet task {task_id} {field} must be a simple token, not a path or provider/model id"
        );
    }
    Ok(())
}

fn is_worker_token_char(ch: char) -> bool {
    ch.is_ascii_alphanumeric() || matches!(ch, '-' | '_' | '.')
}

fn validate_worker_model(task_id: &str, value: Option<&str>) -> Result<()> {
    let Some(value) = value else {
        return Ok(());
    };
    let trimmed = value.trim();
    if trimmed.is_empty() {
        bail!("fleet task {task_id} worker.model cannot be empty");
    }

View on GitHub (pinned to 73e0f67d83)