Hmbown/CodeWhale · error

fleet task worker.model must be a visible model id without…

Error message

fleet task {task_id} worker.model must be a visible model id without whitespace or secrets

What it means

worker.model must be a visible model id: every character ASCII-graphic and free of whitespace, with '=', single quotes, and double quotes disallowed. validate_worker_model rejects values that could smuggle secrets, break quoting, or contain invisible characters. The error text warns against embedding whitespace or secrets in the model id.

Solutions

  1. Set worker.model to a bare ASCII model id like 'claude-sonnet-4' or 'gpt-4o'
  2. Remove '=', quotes, and all whitespace/control characters from the value
  3. Trim the value; never place credentials in the model field (use the token field for secrets)

Example fix

// before
model: Some("gpt-4o key=sk-abc")
// after
model: Some("gpt-4o") // put secrets in the token field
Defensive patterns

Strategy: validation

Validate before calling

fn model_format_ok(v: &str) -> bool { let t = v.trim(); t == v && !t.is_empty() && t.chars().all(|c| c.is_ascii_graphic() && !matches!(c, '=' | '\'' | '"')) }

Type guard

fn as_model_id(v: &str) -> Option<&str> { model_format_ok(v).then_some(v) }

Try / catch

if let Err(e) = validate_worker_model(task_id, value) { if e.to_string().contains("visible model id") { eprintln!("strip whitespace/quotes/= from model id: {e}"); } }

Prevention

When it happens

Trigger: validate_worker_profile sees a model value with spaces, control characters, '=', or quote characters, or with leading/trailing whitespace (trimmed != value).

Common situations: Pasting 'model = "gpt-4o"' including quotes; including an API key or whitespace in the model string; trailing newline from shell substitution.

Understand the failure class

Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.

Related errors


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

Appendix: source

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

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");
    }
    if trimmed != value
        || !trimmed
            .chars()
            .all(|ch| ch.is_ascii_graphic() && !matches!(ch, '=' | '\'' | '"'))
    {
        bail!(
            "fleet task {task_id} worker.model must be a visible model id without whitespace or secrets"
        );
    }
    Ok(())
}

#[allow(clippy::too_many_arguments)]
pub fn write_fleet_artifact_ref(
    workspace: &Path,
    run_id: &FleetRunId,
    task_id: &str,
    worker_id: &str,
    kind: FleetArtifactKind,
    filename: &str,
    contents: &[u8],
    mime_type: Option<&str>,
) -> Result<FleetArtifactRef> {
    let rel_path = PathBuf::from(".codewhale")

View on GitHub (pinned to 73e0f67d83)