Hmbown/CodeWhale · error

Fleet task has invalid worker.agent_profile selector

Error message

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

What it means

Thrown by freeze_fleet_task_members when a task's explicit worker.agent_profile selector fails resolve_member_in_profiles with an internal error (not merely 'no match'). It wraps the resolver's error with the task id and selector, so a task cannot be frozen with a malformed selector string. Distinct from error 1766, which covers a well-formed selector that matches nothing.

Solutions

  1. Fix the selector syntax per the wrapped resolve_member_in_profiles error (the inner message names the concrete problem).
  2. Use an exact existing member/profile name as the agent_profile value.
  3. Remove the worker.agent_profile key if the task should inherit the roster's default posture instead.
  4. Validate selectors against the loaded profile list before writing task metadata.

Example fix

// before
agent_profile = "Reviewer (1)"
// after
agent_profile = "reviewer"
Defensive patterns

Strategy: validation

Validate before calling

// Rust
if let Some(sel) = task.worker.agent_profile.as_deref().map(str::trim).filter(|s| !s.is_empty()) {
    if resolve_member_in_profiles(&profiles, sel).is_err() {
        eprintln!("selector {sel:?} invalid before freeze");
    }
}

Try / catch

// Rust
match freeze_fleet_task_members(&task, &profiles) {
    Err(e) if e.to_string().contains("invalid worker.agent_profile selector") => {
        log::warn!("fixing selector for task {}", task.id);
    }
    other => other?,
}

Prevention

When it happens

Trigger: Freezing a Fleet task whose metadata names worker.agent_profile = "<selector>" where resolve_member_in_profiles returns Err — e.g. a selector with invalid structure (empty components, malformed 'kind:name' syntax) rather than an unknown name.

Common situations: Hand-written selector in task config using wrong syntax (missing colon, stray whitespace patterns the resolver rejects); copy-pasted selector from another fleet with different naming conventions.

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/15fffd52b0d9b642. Report an issue: GitHub.

Appendix: source

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

            }
            continue;
        };
        let explicit_selector = worker
            .agent_profile
            .as_deref()
            .map(str::trim)
            .filter(|selector| !selector.is_empty())
            .map(str::to_string);
        let legacy_role_selector = worker
            .role
            .as_deref()
            .map(str::trim)
            .filter(|selector| !selector.is_empty())
            .map(str::to_string);

        let selected = if let Some(selector) = explicit_selector.as_deref() {
            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}",

View on GitHub (pinned to 73e0f67d83)