Hmbown/CodeWhale · error

fleet task {task_id} worker.model must be a visible model id

Error message

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

What it means

validate_worker_model applies the same rule as profile model hints: worker.model must have no surrounding whitespace and every character must be ASCII graphic except '=', '\'' and '"'. The banned characters exist so quoted ids and embedded secrets (key=value) cannot ride through a task spec.

Source

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

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 0c42157ee5)

Solutions

  1. Write the bare model id: "worker": { "model": "gpt-4o" }
  2. Remove quotes, '=' characters and whitespace from the value
  3. Keep credentials in provider config, never in task spec model fields

Example fix

// before
"worker": { "model": "'claude-sonnet-4'" }

// after
"worker": { "model": "claude-sonnet-4" }
Defensive patterns

Strategy: validation

Validate before calling

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

Type guard

function isVisibleModelId(v: string): boolean {
  const banned = /[\s='"\u0000-\u001f]/;
  return v.trim().length > 0 && v === v.trim() && !banned.test(v);
}

Try / catch

if let Err(err) = load_task_spec_document(&path) {
    if err.to_string().contains("visible model id") {
        eprintln!("{path:?}: worker.model must be a bare id - no quotes, spaces, or '='");
    }
    return Err(err);
}

Prevention

When it happens

Trigger: worker.model = "'gpt-4o'" (quotes pasted from docs), worker.model = "gpt-4o # key=sk-..." (equals sign / appended credential), or a model id containing inner whitespace or a newline.

Common situations: Copying quoted model ids out of documentation; appending credentials to the model string; templated specs interpolating multi-line values into worker.model.

Related errors


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