Hmbown/CodeWhale · error

fleet task {task_id} {field} must be a simple token, not a p

Error message

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

What it means

validate_worker_token requires worker.loadout and worker.model_class to be simple tokens: no leading/trailing whitespace and only ASCII alphanumerics plus '-', '_' and '.' (is_worker_token_char). The message calls out the two most common violations - file paths and provider/model ids - because both contain '/' or ':' and would be silently misresolved downstream.

Source

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

        "worker.agent_profile",
        worker.agent_profile.as_deref(),
    )?;
    validate_worker_token(task_id, "worker.loadout", worker.loadout.as_deref())?;
    validate_worker_token(task_id, "worker.model_class", worker.model_class.as_deref())?;
    validate_worker_model(task_id, worker.model.as_deref())?;
    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 0c42157ee5)

Solutions

  1. Use the bare token name, e.g. worker.loadout = "standard" instead of a path
  2. Put provider/model routes in worker.model, which accepts the richer id syntax - loadout and model_class take tokens only
  3. Strip whitespace and path separators when generating these fields

Example fix

// before
"worker": { "loadout": "./loadouts/standard.toml" }

// after
"worker": { "loadout": "standard" }
Defensive patterns

Strategy: validation

Validate before calling

fn is_worker_token(s: &str) -> bool {
    let t = s.trim();
    !t.is_empty()
        && t == s
        && t.chars().all(|c| c.is_ascii_alphanumeric() || matches!(c, '-' | '_' | '.'))
}

Type guard

function isWorkerToken(v: string): boolean {
  return v.trim().length > 0 && v === v.trim() && /^[A-Za-z0-9._-]+$/.test(v);
}

Try / catch

if let Err(err) = load_task_spec_document(&path) {
    if err.to_string().contains("must be a simple token, not a path") {
        eprintln!("{path:?}: worker.loadout/model_class take bare tokens - no paths like ./x.toml, no provider/model ids");
    }
    return Err(err);
}

Prevention

When it happens

Trigger: worker.loadout = "./loadouts/standard.toml" (a path), worker.model_class = "openai/gpt-4o" (a provider/model id), or a value with spaces like "standard loadout".

Common situations: Pointing loadout at a file instead of naming the loadout; copying a full model route into model_class; assuming these fields accept the same syntax as the profile loader's model field.

Related errors


AI-assisted analysis of Hmbown/CodeWhale@0c42157ee5 (2026-08-20). Data as JSON: /api/errors/05160b5a4da683be. Report an issue: GitHub.