Hmbown/CodeWhale · error

fleet task {} references unknown agent profile {profile_id:?

Error message

fleet task {} references unknown agent profile {profile_id:?}

What it means

The task's `worker.agent_profile` names a profile id that is not present in the loaded set of agent profiles. The lookup in `resolve agent profile` (crates/tui/src/fleet/worker_runtime.rs) does an exact id match over the profiles discovered from their TOML files; the reference is trimmed and empty values are ignored, but any non-empty unknown id aborts the task. The id is printed with {:?} so stray whitespace is visible in the message.

Source

Thrown at crates/tui/src/fleet/worker_runtime.rs:732

fn resolve_task_agent_profile<'a>(
    task_spec: &FleetTaskSpec,
    agent_profiles: &'a [AgentProfile],
) -> Result<Option<&'a AgentProfile>> {
    let Some(profile_id) = task_spec
        .worker
        .as_ref()
        .and_then(|worker| worker.agent_profile.as_deref())
        .map(str::trim)
        .filter(|id| !id.is_empty())
    else {
        return Ok(None);
    };
    let Some(profile) = agent_profiles
        .iter()
        .find(|profile| profile.id == profile_id)
    else {
        bail!(
            "fleet task {} references unknown agent profile {profile_id:?}",
            task_spec.id
        );
    };
    Ok(Some(profile))
}

fn effective_fleet_role(
    worker_profile: Option<&FleetTaskWorkerProfile>,
    agent_profile: Option<&AgentProfile>,
) -> Option<String> {
    effective_fleet_role_with_source(worker_profile, agent_profile).0
}

fn effective_fleet_role_with_source(
    worker_profile: Option<&FleetTaskWorkerProfile>,
    agent_profile: Option<&AgentProfile>,
) -> (Option<String>, Option<&'static str>) {

View on GitHub (pinned to 0c42157ee5)

Solutions

  1. Check the printed id (it is quoted, so whitespace shows) and fix typos or trailing spaces in the task's `agent_profile`.
  2. Verify the profile exists: list the discovered agent profile TOML files and confirm one has `id = "<that value>"`.
  3. If the profile was renamed, update the task to the new id — or drop `agent_profile` to fall back to role/defaults.

Example fix

# before
[worker]
agent_profile = "implementer "   # profile file defines id = "implementer"

# after
[worker]
agent_profile = "implementer"
Defensive patterns

Strategy: validation

Validate before calling

fn all_profiles_resolve(tasks: &[FleetTaskSpec], profiles: &[AgentProfile]) -> Option<String> {
    for task in tasks {
        if let Some(id) = task.worker.as_ref().and_then(|w| w.agent_profile.as_deref()) {
            let id = id.trim();
            if !id.is_empty() && !profiles.iter().any(|p| p.id == id) {
                return Some(format!("{} -> {}", task.id, id));
            }
        }
    }
    None
}

Type guard

fn profile_exists(profile_id: &str, profiles: &[AgentProfile]) -> bool {
    profiles.iter().any(|p| p.id == profile_id.trim())
}

Prevention

When it happens

Trigger: `agent_profile = "implementer"` when the profiles directory only defines "coder"; a renamed or deleted profile file; profile discovery rooted at a different directory than the one containing your profile; a typo or invisible trailing space in the id.

Common situations: Sharing task specs across machines with different profile sets; reorganizing .codewhale/fleet profile files; profiles behind a gitignored path that was never created on a fresh clone.

Related errors


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