Hmbown/CodeWhale · error

Fleet task has invalid worker.role member selector

Error message

Fleet task {} has invalid worker.role member selector {selector:?}: {error}

What it means

Thrown by freeze_fleet_task_members when a legacy worker.role value is being resolved as a member selector (because an exact Fleet/roster is in play) and resolve_member_in_profiles errors on it. The code path preserves the historical 'role is a posture' contract but treats ambiguity as fatal when a roster is selected, wrapping the resolver error with the task id.

Solutions

  1. Rename the value into a valid worker.agent_profile selector, or change worker.role to a valid posture label (e.g. consultant/advisory).
  2. Fix the selector per the wrapped resolver error's concrete complaint.
  3. Add a matching member profile for the intended role so resolution succeeds.
  4. Update legacy configs to the member-selector scheme after the roster migration.

Example fix

// before
role = "senior-reviewer"
// after
agent_profile = "senior-reviewer" # or role = "consultant" for a posture
Defensive patterns

Strategy: validation

Validate before calling

// Rust
const POSTURES: [&str; 2] = ["consultant", "advisory"];
if let Some(role) = task.worker.role.as_deref() {
    if !POSTURES.contains(&role) && resolve_member_in_profiles(&profiles, role).is_err() {
        eprintln!("role {role:?} is neither a posture nor a valid member selector");
    }
}

Prevention

When it happens

Trigger: Freezing a task that sets worker.role to a non-posture string while an exact roster is required: resolve_member_in_profiles rejects the string's structure, e.g. role = "senior reviewer" with selector syntax the resolver cannot parse.

Common situations: Older configs using free-text role labels now interpreted as member selectors after the roster feature landed; role containing characters the selector grammar forbids; mixing role and member naming schemes after migration.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


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

Appendix: source

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

            let selected = resolve_member_in_profiles(agent_profiles, selector).map_err(|error| {
                anyhow::anyhow!(
                    "Fleet task {} has invalid worker.agent_profile selector {selector:?}: {error}",
                    task.id
                )
            })?;
            Some(selected.ok_or_else(|| {
                anyhow::anyhow!(
                    "Fleet task {} references unknown agent profile selector {selector:?}",
                    task.id
                )
            })?)
        } else if let Some(selector) = legacy_role_selector.as_deref() {
            // `role` was historically only a posture. Preserve that contract
            // when no exact Fleet is selected and a roster lookup is absent.
            // Ambiguity is never a posture: silently dropping it would make a
            // selected team launch an anonymous session-route worker.
            match resolve_member_in_profiles(agent_profiles, selector).map_err(|error| {
                anyhow::anyhow!(
                    "Fleet task {} has invalid worker.role member selector {selector:?}: {error}",
                    task.id
                )
            })? {
                Some(profile) => Some(profile),
                None if require_exact_member => {
                    bail!(
                        "Fleet task {} worker.role selector {selector:?} does not name a member in the explicitly selected Fleet",
                        task.id
                    )
                }
                None => None,
            }
        } else if require_exact_member {
            bail!(
                "Fleet task {} must name one member from the explicitly selected Fleet",
                task.id
            );

View on GitHub (pinned to 73e0f67d83)