{"record":{"id":"fd1313d0ad76aa4b","repo":"Hmbown/CodeWhale","slug":"fleet-task-references-unknown-agent-profile-selector","errorCode":null,"errorMessage":"Fleet task {} references unknown agent profile selector {selector:?}","messagePattern":"Fleet task (.+?) references unknown agent profile selector (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/fleet/worker_runtime.rs","lineNumber":1001,"sourceCode":"        return Ok(Some(Cow::Owned(snapshot.into_profile()?)));\n    }\n    let Some(worker) = task_spec.worker.as_ref() else {\n        return Ok(None);\n    };\n    if let Some(selector) = worker\n        .agent_profile\n        .as_deref()\n        .map(str::trim)\n        .filter(|selector| !selector.is_empty())\n    {\n        let profile = resolve_member_in_profiles(agent_profiles, selector).map_err(|error| {\n            anyhow::anyhow!(\n                \"Fleet task {} has invalid worker.agent_profile selector {selector:?}: {error}\",\n                task_spec.id\n            )\n        })?;\n        let Some(profile) = profile else {\n            bail!(\n                \"Fleet task {} references unknown agent profile selector {selector:?}\",\n                task_spec.id\n            );\n        };\n        validate_selected_member_model(task_spec, profile)?;\n        return Ok(Some(Cow::Borrowed(profile)));\n    }\n\n    let Some(selector) = worker\n        .role\n        .as_deref()\n        .map(str::trim)\n        .filter(|selector| !selector.is_empty())\n    else {\n        return Ok(None);\n    };\n    // `worker.role` predates human member selectors. Resolve it only when one\n    // member is deterministic; an ambiguous/missing roster match remains the","sourceCodeStart":983,"sourceCodeEnd":1019,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/fleet/worker_runtime.rs#L983-L1019","documentation":"A fleet task's worker.agent_profile selector was resolved but no agent profile with that id/selector exists in the session's profile set. resolve_task_agent_profile looks up the selector after validating its syntax; the bail fires when the lookup returns None, meaning the task references a profile that has not been defined.","triggerScenarios":"Any call chain through resolve_task_agent_profile (validate_task_agent_profiles, validate_fleet_task_routes, validate_fleet_reasoning_effort, fleet_task_to_worker_spec_with_profiles, resolve_fleet_route_with_config, resolve_fleet_route_from_worker_report) with a task_spec whose worker.agent_profile names a selector absent from the loaded profile registry (after trimming, per the underlying selector parser).","commonSituations":"Typo or case mismatch in the agent_profile name in the fleet config; profile deleted or renamed while tasks still reference it; profile defined in a different config file that was not loaded; copy-pasting a fleet config between machines with different profile sets.","solutions":["Run the profile validation path (validate_task_agent_profiles) and fix the selector spelling to match a defined profile id.","Add the missing agent profile definition to the session config.","Remove the worker.agent_profile field from the task so it inherits the default route.","Validate all task profile references at config load with the same resolver used at runtime."],"exampleFix":"// before\n[task.research]\nworker.agent_profile = \"deep-reserch\"\n// after\n[task.research]\nworker.agent_profile = \"deep-research\"","handlingStrategy":"validation","validationCode":"fn profile_exists(profiles: &[AgentProfile], selector: &str) -> bool {\n    profiles.iter().any(|p| p.matches_selector(selector.trim()))\n}","typeGuard":"fn resolve<'a>(profiles: &'a [AgentProfile], sel: &str) -> Option<&'a AgentProfile> {\n    profiles.iter().find(|p| p.id == sel.trim())\n}","tryCatchPattern":"match resolve_task_agent_profile(&task, &profiles) {\n    Err(e) if e.to_string().contains(\"unknown agent profile\") => {\n        eprintln!(\"task {}: profile {:?} not defined; available: {:?}\", task.id, sel, ids); }\n    other => other?,\n}","preventionTips":["List available profile ids in config error messages","Validate all task->profile references at fleet-config load","Keep profile definitions in the same config file/version as the tasks that use them"],"tags":["fleet","config","reference"],"backgroundTag":"entity-not-found","analyzedSha":"73e0f67d83c59909b571efdfc88c4bc28c309cb1","analyzedAt":"2026-09-22T01:30:00.501Z","contentChangedAt":"2026-09-22T01:30:00.501Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}